public AddEndpointWindow(IModalService modalService, WuEndpointCollection endpointCollection, WuEndpointFactory endpointFactory) { _modalService = modalService ?? throw new ArgumentNullException(nameof(modalService)); _endpointCollection = endpointCollection ?? throw new ArgumentNullException(nameof(endpointCollection)); _wuEndpointFactory = endpointFactory; InitializeComponent(); TextBoxUrlInput.Text = $"{AddHostViewModel.DefaultScheme}://localhost:{AddHostViewModel.DefaultPort}/{AddHostViewModel.DefaultPath}"; }
public DisconnectEndpointsCommand(WuEndpointCollection endpointMgr, Func <IEnumerable <IWuEndpoint> > wuEndpointSelector) { if (wuEndpointSelector == null) { throw new ArgumentNullException(nameof(wuEndpointSelector)); } if (endpointMgr == null) { throw new ArgumentNullException(nameof(endpointMgr)); } WuEndpointSelector = wuEndpointSelector; em = endpointMgr; }
public InfoWindowViewModel(IModalService modalService, WuEndpointCollection endpointCollection) { if (endpointCollection == null) { throw new ArgumentNullException(nameof(endpointCollection)); } if (modalService == null) { throw new ArgumentNullException(nameof(modalService)); } ModalService = modalService; EndpointCollection = endpointCollection; }
public InfoWindow(IModalService modalService, WuEndpointCollection endpointCollection) { if (modalService == null) { throw new ArgumentNullException(nameof(modalService)); } if (endpointCollection == null) { throw new ArgumentNullException(nameof(endpointCollection)); } Model = new InfoWindowViewModel(modalService, endpointCollection); DataContext = Model; InitializeComponent(); Model.LoadDataAsync(); }
public void Should_DismissConnection_When_ConnectToAlreadyConntectedHost() { var wuEndpoint = new Mock <IWuEndpoint>(); wuEndpoint.Setup(e => e.ConnectionState).Returns(CommunicationState.Created); wuEndpoint.Setup(e => e.FQDN).Returns("samename"); var endpointCol = new WuEndpointCollection(); var result1 = WaitForTaskAndThrow(AddHostViewModel.ConnectToHosts( new WuEndpointFactoryMock(null, true, wuEndpoint.Object, wuEndpoint.Object), endpointCol, $"samename{Environment.NewLine}samename"), 5000); var result2 = WaitForTaskAndThrow(AddHostViewModel.ConnectToHosts( new WuEndpointFactoryMock(null, true, wuEndpoint.Object), endpointCol, $"samename"), 5000); Assert.IsTrue(result1.Count() == 1); Assert.IsTrue(result2.Count() == 0); Assert.IsTrue(endpointCol.Count == 1); }