Skip to content

Commit

Permalink
refactor: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Dec 3, 2023
1 parent 9797c0a commit f31c964
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion samples/TodoApp/UI/Shared/BarConnectionStatus.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@{
var m = State.Value;
var isOk = m.LikelyConnected;
var isOk = m.Kind is not RpcPeerStateKind.Disconnected;
var iconName = isOk
? FontAwesomeIcons.Cloud
: FontAwesomeIcons.ExclamationTriangle;
Expand Down
2 changes: 1 addition & 1 deletion samples/TodoApp/UI/Shared/TextConnectionStatus.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@{
var m = State.Value;
var isOk = m.LikelyConnected;
var isOk = m.Kind is not RpcPeerStateKind.Disconnected;
}

<Div Margin="Margin.Is1.OnY" TextColor="@(isOk ? TextColor.Default : TextColor.Warning)">
Expand Down
11 changes: 6 additions & 5 deletions tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ public async Task PeerMonitorTest()
var clientPeer = testClient.Connections.First().Value.ClientPeer;
var monitor = new RpcPeerStateMonitor(services, clientPeer);
var state = monitor.State;
await state.When(x => x.IsConnected).WaitAsync(TimeSpan.FromSeconds(1));
await state.When(x => x.Kind == RpcPeerStateKind.JustConnected).WaitAsync(TimeSpan.FromSeconds(1));
await state.When(x => x.Kind == RpcPeerStateKind.Connected).WaitAsync(TimeSpan.FromSeconds(2));

_ = clientPeer.Disconnect(false, new InvalidOperationException("Disconnected!"));
await state.When(x => x.Kind == RpcPeerStateKind.JustDisconnected)
.WaitAsync(TimeSpan.FromSeconds(2));
await state.When(x => !x.LikelyConnected).WaitAsync(TimeSpan.FromSeconds(5));
await state.When(x => x.Kind == RpcPeerStateKind.JustDisconnected).WaitAsync(TimeSpan.FromSeconds(1));
await state.When(x => x.Kind == RpcPeerStateKind.Disconnected).WaitAsync(TimeSpan.FromSeconds(5));

await testClient[clientPeer].Connect();
await state.When(x => x.IsConnected).WaitAsync(TimeSpan.FromSeconds(1));
await state.When(x => x.Kind == RpcPeerStateKind.JustConnected).WaitAsync(TimeSpan.FromSeconds(1));
await state.When(x => x.Kind == RpcPeerStateKind.Connected).WaitAsync(TimeSpan.FromSeconds(2));
}
}

0 comments on commit f31c964

Please sign in to comment.