public void WhenShowParentWindow_ItActivates() { //Arrange var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose); var mainVM = new MainViewModel { EventAggregator = eventAggregator }; var parentWindow = new BaseTopLevelWindow(); var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); mainVM.Windows.Add(parentWindow); mainVM.ShowChildWindow(parentWindow, childWindow); // Act mainVM.ShowParentWindow(parentWindow); //Assert Assert.AreEqual(parentWindow, mainVM.SelectedWindow); }
/// <summary> /// Whens the create new item from checklist_ answer details is also parent window. /// <author>Unknown</author>. /// </summary> /// [TestMethod] public void WhenCreateNewItemFromChecklist_AnswerDetailsIsAlsoParentWindow() { var eventAggregator = Mock.Create<IEventAggregator>(); var mainVM = new MainViewModel { EventAggregator = eventAggregator }; var window1 = new BaseTopLevelWindow(); var window2 = Mock.Create<ITopLevelWindow>(); var window3 = Mock.Create<ITopLevelWindow>(); var childWindow = Mock.Create<ITopLevelWindow>(); Mock.Arrange(() => window3.ParentWindow).Returns(window2); Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); mainVM.Windows.Add(window1); mainVM.Windows.Add(window2); mainVM.ShowChildWindow(window3, childWindow); Assert.IsNotNull(mainVM.SelectedWindow); Assert.IsTrue(childWindow.IsVisible); Assert.IsTrue(childWindow.IsSelected); Assert.AreEqual(childWindow.ParentWindow, window2); }
public void WhenShowChildWindow_TitleCopiedToOriginalTitle() { //Arrange var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose); var mainVM = new MainViewModel { EventAggregator = eventAggregator }; var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); var childWindow = new BaseTopLevelWindow(); mainVM.Windows.Add(parentWindow); Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); var title = Guid.NewGuid().ToString(); childWindow.Title = title; // Act mainVM.ShowChildWindow(parentWindow, childWindow); //Assert Assert.AreEqual(title, childWindow.OriginalTitle); }
public void AfterShowGrandChildWindow_BreadCrumbsCountIncreases() { // Arrange var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose); var mainVM = new MainViewModel { EventAggregator = eventAggregator }; var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); var childWindow = new BaseTopLevelWindow(); var grandChildWindow = new BaseTopLevelWindow(); mainVM.Windows.Add(parentWindow); Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); //Act mainVM.ShowChildWindow(parentWindow, childWindow); mainVM.ShowChildWindow(childWindow, grandChildWindow); // Assert Assert.AreEqual(grandChildWindow.Breadcrumbs.Count, 3); }
public void AfterShowChildWindow_ParentWindowIsInvisible() { // Arrange var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose); var mainVM = new MainViewModel { EventAggregator = eventAggregator }; var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); mainVM.Windows.Add(parentWindow); Mock.Arrange(() => parentWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); Mock.Arrange(() => childWindow.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>()); //Act mainVM.ShowChildWindow(parentWindow, childWindow); // Assert Assert.IsFalse(parentWindow.IsVisible); }
public void WhenPassWindowNotInWindowsCollection_ThrowsException() { var mainVM = new MainViewModel(); var parentWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); var childWindow = Mock.Create<ITopLevelWindow>(Behavior.Loose); mainVM.ShowChildWindow(parentWindow, childWindow); }
public void WhenPassNullParentWindowToShowChildWindow_ThrowsException() { var mainVM = new MainViewModel(); var window1 = Mock.Create<ITopLevelWindow>(Behavior.Loose); mainVM.ShowChildWindow(null, window1); }