Пример #1
0
        public void TestNavigation()
        {
            var nav  = new TestNavigationService();
            var data = new TestDataService();

            var vm = new MainViewModel(data, nav);

            vm.NavigateCommand.Execute(null);

            Assert.AreEqual(new Uri("SecondPage.xaml", UriKind.Relative), nav.CurrentUri);
        }
Пример #2
0
        public void TestMethod1()
        {
            var nav  = new TestNavigationService();
            var data = new TestDataService();

            const string testProp1 = "this is a test";
            const int    testProp2 = 1234;

            data.Initialize(testProp1, testProp2);

            var vm = new MainViewModel(data, nav);

            Assert.AreEqual(
                string.Format("{0} / {1}", testProp1, testProp2),
                vm.WelcomeTitle);
        }
Пример #3
0
        public void TestWelcomeTitle()
        {
            var nav  = new TestNavigationService();
            var data = new TestDataService();

            var vm = new MainViewModel(data, nav);

            var propertyChangedWasRaised = false;

            vm.PropertyChanged += (s, e) =>
            {
                propertyChangedWasRaised = true;
            };

            Assert.IsFalse(propertyChangedWasRaised);

            vm.WelcomeTitle = "This is a new value";

            Assert.IsTrue(propertyChangedWasRaised);
        }