Ejemplo n.º 1
0
        public void WhenShowExistingTaskWindow_ItReactivates()
        {
            // Arrange
            var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
            var mainVM = new MainViewModel { EventAggregator = eventAggregator };
            var window1 = Mock.Create<ITopLevelWindow>(Behavior.Loose);
            var window2 = Mock.Create<ITopLevelWindow2>(Behavior.Loose);
            Mock.Arrange(() => window1.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());
            Mock.Arrange(() => window2.Breadcrumbs).Returns(new ObservableCollection<IBreadcrumbItem>());

            // Act
            mainVM.ShowTaskWindow(window1, false);
            mainVM.ShowTaskWindow(window2, false);
            Assert.AreEqual(window2, mainVM.SelectedWindow);
            mainVM.ShowTaskWindow(window1, false);

            // Assert
            Assert.AreEqual(window1, mainVM.SelectedWindow);
            Assert.AreEqual(2, mainVM.Windows.Count);
        }