Пример #1
0
        public MockPageWithViewModel()
        {
            var viewModel = new MockViewModelWithRestorableStateAttributes();

            viewModel.Title  = "testtitle";
            this.DataContext = viewModel;
        }
Пример #2
0
        public void OnNavigatedTo_With_RestorableStateAttribute()
        {
            var viewModelState = new Dictionary<string, object>();
            viewModelState.Add("Title", "MyMock");
            viewModelState.Add("Description", "MyDescription");

            var vm = new MockViewModelWithRestorableStateAttributes();
            vm.OnNavigatedTo(null, NavigationMode.Back, viewModelState);

            Assert.AreEqual(vm.Title, viewModelState["Title"]);
            Assert.AreEqual(vm.Description, viewModelState["Description"]);
        }
Пример #3
0
        public void OnNavigatedFrom_With_RestorableStateAttributes()
        {
            var vm = new MockViewModelWithRestorableStateAttributes()
            {
                Title = "MyMock",
                Description = "MyDescription",
            };
            var result = new Dictionary<string, object>();

            vm.OnNavigatedFrom(result, true);

            Assert.IsTrue(result.Keys.Count == 2);
            Assert.AreEqual("MyMock", result["Title"]);
            Assert.AreEqual("MyDescription", result["Description"]);
        }
Пример #4
0
 public MockPageWithViewModel()
 {
     var viewModel = new MockViewModelWithRestorableStateAttributes();
     viewModel.Title = "testtitle";
     this.DataContext = viewModel;
 }