public async Task WhenNoTunnelSelected_ThenDisconnectSelectedTunnelDoesNothing() { var viewModel = new TunnelsViewModel( CreateTunnelBroker(1).Object, CreateConfirmationDialog(DialogResult.Cancel).Object, new MockEventService()); viewModel.RefreshTunnels(); Assert.AreEqual(1, viewModel.Tunnels.Count); await viewModel.DisconnectSelectedTunnelAsync(); Assert.AreEqual(1, viewModel.Tunnels.Count); }
public async Task WhenTunnelSelectedAndDisconnectNotConfirmed_ThenTunnelIsLeftOpen() { var broker = CreateTunnelBroker(1); var viewModel = new TunnelsViewModel( broker.Object, CreateConfirmationDialog(DialogResult.Cancel).Object, new MockEventService()); viewModel.RefreshTunnels(); viewModel.SelectedTunnel = viewModel.Tunnels[0]; Assert.AreEqual(1, viewModel.Tunnels.Count); await viewModel.DisconnectSelectedTunnelAsync(); broker.Verify(b => b.DisconnectAsync(It.IsAny <TunnelDestination>()), Times.Never); Assert.IsNotNull(viewModel.SelectedTunnel); }