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

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => vmManager.UnregisterModel(null, model));
            }
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 ThrowsArgumentNullExceptionForNullModel()
            {
                var model     = new Person();
                var vm        = new TestViewModel(model);
                var vmManager = new ViewModelManager();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => vmManager.UnregisterModel(vm, null));
            }
Ejemplo n.º 4
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);
            }