Exemple #1
0
            public void ReturnsNullForUnregisteredChildViewModels()
            {
                var viewModelManager = new ViewModelManager();

                var foundViewModels = viewModelManager.GetChildViewModels(42);

                Assert.AreEqual(0, foundViewModels.Count());
            }
Exemple #2
0
            public void ReturnsChildViewModelsUsingParentInstance()
            {
                var parentViewModel  = new TestViewModel() as IRelationalViewModel;
                var childViewModel   = new TestViewModel() as IRelationalViewModel;
                var viewModelManager = new ViewModelManager();

                parentViewModel.RegisterChildViewModel(childViewModel as IViewModel);
                childViewModel.SetParentViewModel(parentViewModel as IViewModel);

                viewModelManager.RegisterViewModelInstance(parentViewModel as IViewModel);
                viewModelManager.RegisterViewModelInstance(childViewModel as IViewModel);

                var foundViewModels = viewModelManager.GetChildViewModels(parentViewModel as IViewModel);

                Assert.IsNotNull(foundViewModels);
                Assert.IsTrue(foundViewModels.Contains(childViewModel));
            }
            public void ReturnsChildViewModelsUsingParentInstance()
            {
                var parentViewModel = new TestViewModel() as IRelationalViewModel;
                var childViewModel = new TestViewModel() as IRelationalViewModel;
                var viewModelManager = new ViewModelManager();

                parentViewModel.RegisterChildViewModel(childViewModel as IViewModel);
                childViewModel.SetParentViewModel(parentViewModel as IViewModel);

                viewModelManager.RegisterViewModelInstance(parentViewModel as IViewModel);
                viewModelManager.RegisterViewModelInstance(childViewModel as IViewModel);

                var foundViewModels = viewModelManager.GetChildViewModels(parentViewModel as IViewModel);

                Assert.IsNotNull(foundViewModels);
                Assert.IsTrue(foundViewModels.Contains(childViewModel));
            }
            public void ReturnsNullForUnregisteredChildViewModels()
            {
                var viewModelManager = new ViewModelManager();

                var foundViewModels = viewModelManager.GetChildViewModels(42);

                Assert.AreEqual(0, foundViewModels.Count());
            }