Ejemplo n.º 1
0
            public void ReturnsNullForUnregisteredModel()
            {
                var model     = new Person();
                var vmManager = new ViewModelManager();

                var foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();

                Assert.IsNull(foundVm);
            }
Ejemplo n.º 2
0
            public void UnregistersModelForViewModel()
            {
                var model     = new Person();
                var vm        = new TestViewModel(model);
                var vmManager = new ViewModelManager();

                vmManager.RegisterViewModelInstance(vm);
                vmManager.RegisterModel(vm, model);

                var foundVm = vmManager.GetViewModelsOfModel(model).First();

                Assert.AreEqual(vm, foundVm);

                vmManager.UnregisterModel(vm, model);

                foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();

                Assert.IsNull(foundVm);
            }
Ejemplo n.º 3
0
            public void ReturnsViewModelOfRegisteredModel()
            {
                var model     = new Person();
                var vm        = new TestViewModel(model);
                var vmManager = new ViewModelManager();

                vmManager.RegisterViewModelInstance(vm);
                vmManager.RegisterModel(vm, model);

                var foundVm = vmManager.GetViewModelsOfModel(model).First();

                Assert.AreEqual(vm, foundVm);
            }
Ejemplo n.º 4
0
            public void RegistersModelForViewModel()
            {
                var model = new Person();
                var vm = new TestViewModel(model);
                var vmManager = new ViewModelManager();

                vmManager.RegisterViewModelInstance(vm);
                vmManager.RegisterModel(vm, model);

                var foundVm = vmManager.GetViewModelsOfModel(model).First();

                Assert.AreEqual(vm, foundVm);
            }
Ejemplo n.º 5
0
            public void ReturnsNullForUnregisteredModel()
            {
                var model = new Person();
                var vmManager = new ViewModelManager();

                var foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();

                Assert.IsNull(foundVm);
            }
Ejemplo n.º 6
0
            public void UnregistersAllModelForViewModel()
            {
                var model = new Person();
                var vm = new TestViewModel(model);
                var vmManager = new ViewModelManager();

                vmManager.RegisterViewModelInstance(vm);
                vmManager.RegisterModel(vm, model);
                
                var foundVm = vmManager.GetViewModelsOfModel(model).First();

                Assert.AreEqual(vm, foundVm);

                vmManager.UnregisterAllModels(vm);

                foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();

                Assert.IsNull(foundVm);
            }