Beispiel #1
0
        public void NotifyPropertyChangedTests()
        {
            var windowMock = Mock.Create<ITopLevelWindow>(Behavior.CallOriginal);
            var vm = new BreadcrumbItem(windowMock);

            TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.Title);
        }
Beispiel #2
0
        public void WhenWindowHasNoChild_CanGoToWindowIsFalse()
        {
            var windowMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);
            var vm = new BreadcrumbItem(windowMock);

            Assert.IsFalse(vm.GoToWindowCommand.CanExecute(null));
        }
Beispiel #3
0
        public void PublicPropertiesGetSetTest()
        {
            var windowMock = Mock.Create<ITopLevelWindow>(Behavior.CallOriginal);
            var vm = new BreadcrumbItem(windowMock);

            TestsHelper.TestPublicPropertiesGetSet(vm);
        }
Beispiel #4
0
        public void WhenWindowHasChild_CanGoToWindowIsTrue()
        {
            var childWindowMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);
            var windowMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);

            Mock.Arrange(() => windowMock.ChildWindow).Returns(childWindowMock);
            var vm = new BreadcrumbItem(windowMock);
            
            Assert.IsTrue(vm.GoToWindowCommand.CanExecute(null));
        }
Beispiel #5
0
        public void GoToWindowCommand_ClosesAllChildWindows()
        {
            var grandChildClosed = false;
            var childClosed = false;
            var windowClosed = false;

            var grandChildMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);
            
            Mock.Arrange(() => grandChildMock.CloseCommand).Returns(new ActionCommand<object>(o => grandChildClosed = true));

            var childMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);

            Mock.Arrange(() => childMock.CloseCommand).Returns(new ActionCommand<object>(o => childClosed = true));
            Mock.Arrange(() => childMock.ChildWindow).Returns(grandChildMock);

            var windowMock = Mock.Create<ITopLevelWindow>(Behavior.Loose);

            Mock.Arrange(() => windowMock.ChildWindow).Returns(childMock);
            Mock.Arrange(() => windowMock.CloseCommand).Returns(new ActionCommand<object>(o => windowClosed = true));

            Mock.Arrange(() => grandChildMock.ParentWindow).Returns(childMock);
            Mock.Arrange(() => childMock.ParentWindow).Returns(windowMock);

            var vm = new BreadcrumbItem(windowMock);

            vm.GoToWindowCommand.Execute(null);

            Assert.IsTrue(grandChildClosed);
            Assert.IsTrue(childClosed);
            Assert.IsFalse(windowClosed);
        }