예제 #1
0
        public void NotifyPropertyChangedTests()
        {
            var modelMock = Mock.Create<IPageableList>(Behavior.CallOriginal);
            var vm = new PageItem(modelMock);

            TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.IsChecked);
        }
예제 #2
0
        public void PublicPropertiesGetSetTest()
        {
            var modelMock = Mock.Create<IPageableList>(Behavior.CallOriginal);
            var vm = new PageItem(modelMock);

            TestsHelper.TestPublicPropertiesGetSet(vm);
        }
예제 #3
0
        public void PageCommandTest()
        {
            var modelRefreshInvoked = false;
            var modelPageNumber = -1;
            var modelMock = Mock.Create<IPageableList>(Behavior.CallOriginal);

            Mock.Arrange(() => modelMock.Refresh(Arg.IsAny<int>())).DoInstead(
                (int page) =>
                    {
                        modelRefreshInvoked = true;
                        modelPageNumber = page;
                    });

            var vm = new PageItem(modelMock) { PageNumber = 123, IsChecked = false };

            vm.PageCommand.Execute(null);

            Assert.IsTrue(modelRefreshInvoked);
            Assert.AreEqual(vm.PageNumber, modelPageNumber);
            Assert.IsTrue(vm.IsChecked);
        }