From f31c964e6430205102c17e2f6c2ca7afb906c811 Mon Sep 17 00:00:00 2001 From: Alex Yakunin Date: Sun, 3 Dec 2023 07:41:53 -0800 Subject: [PATCH] refactor: minor changes --- samples/TodoApp/UI/Shared/BarConnectionStatus.razor | 2 +- samples/TodoApp/UI/Shared/TextConnectionStatus.razor | 2 +- tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/samples/TodoApp/UI/Shared/BarConnectionStatus.razor b/samples/TodoApp/UI/Shared/BarConnectionStatus.razor index 5eef1c1a..234fcbfa 100644 --- a/samples/TodoApp/UI/Shared/BarConnectionStatus.razor +++ b/samples/TodoApp/UI/Shared/BarConnectionStatus.razor @@ -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; diff --git a/samples/TodoApp/UI/Shared/TextConnectionStatus.razor b/samples/TodoApp/UI/Shared/TextConnectionStatus.razor index 1bdf2557..3cdfb26b 100644 --- a/samples/TodoApp/UI/Shared/TextConnectionStatus.razor +++ b/samples/TodoApp/UI/Shared/TextConnectionStatus.razor @@ -3,7 +3,7 @@ @{ var m = State.Value; - var isOk = m.LikelyConnected; + var isOk = m.Kind is not RpcPeerStateKind.Disconnected; }
diff --git a/tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs b/tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs index 4706df65..d956e2da 100644 --- a/tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs +++ b/tests/Stl.Fusion.Tests/FusionRpcBasicTest.cs @@ -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)); } }