Interaction logic for HelpWindow.xaml
Ejemplo n.º 1
0
 public async Task HelpViewModel_LoadBrowserUri_HasNoInternetConnection_NavigatesToOnDiskResource()
 {
     //------------Setup for test--------------------------
     const string uri = "http://community.warewolf.io/";
     var networkHelper = new Mock<INetworkHelper>();
     var task = new Task<bool>(() => false);
     task.RunSynchronously();
     networkHelper.Setup(m => m.HasConnectionAsync(It.IsAny<string>()))
         .Returns(task);
     var helpViewWrapper = new Mock<IHelpViewWrapper>(); 
     helpViewWrapper.Setup(m => m.Navigate(It.IsAny<string>())).Verifiable();
     var helpViewModel = new HelpViewModel(networkHelper.Object,helpViewWrapper.Object, false);
     HelpView helpView = new HelpView();
     helpViewWrapper.SetupGet(m => m.HelpView).Returns(helpView);
     //------------Execute Test---------------------------
     await helpViewModel.LoadBrowserUri(uri);
     //------------Assert Results-------------------------
     helpViewWrapper.Verify(m => m.Navigate(It.IsAny<string>()), Times.Once());
     Assert.IsNotNull(helpViewModel.Uri);
     Assert.IsNotNull(helpViewModel.ResourcePath);
 }
Ejemplo n.º 2
0
 public HelpViewWrapper(HelpView view)
 {
     HelpView = view;
 }
Ejemplo n.º 3
0
 public void HelpViewModel_Handle_TabClosedMessageContextIsAnotherInstance_IsNotDisposed()
 {
     //------------Setup for test--------------------------
     var helpViewWrapper = new Mock<IHelpViewWrapper>();
     WebBrowser webBrowser = new WebBrowser();
     helpViewWrapper.SetupGet(m => m.WebBrowser).Returns(webBrowser);
     helpViewWrapper.Setup(m => m.Navigate(It.IsAny<string>())).Verifiable();
     var helpViewModel = new HelpViewModel(null, helpViewWrapper.Object, false);
     HelpView helpView = new HelpView();
     helpViewWrapper.SetupGet(m => m.HelpView).Returns(helpView);
     //------------Execute Test---------------------------
     helpViewModel.Handle(new TabClosedMessage(new HelpViewModel()));
     //------------Assert Results-------------------------
     Assert.IsFalse(helpViewModel.HelpViewDisposed);
 }