本文整理汇总了C#中ViewModelManager类的典型用法代码示例。如果您正苦于以下问题:C# ViewModelManager类的具体用法?C# ViewModelManager怎么用?C# ViewModelManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewModelManager类属于命名空间,在下文中一共展示了ViewModelManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThrowsArgumentNullExceptionForNullViewModel
public void ThrowsArgumentNullExceptionForNullViewModel()
{
var model = new Person();
var vmManager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => vmManager.UnregisterModel(null, model));
}
示例2: RegistersModelForViewModel
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);
}
示例3: UnregisterViewModelInstance_NotExistingViewModel
public void UnregisterViewModelInstance_NotExistingViewModel()
{
var manager = new ViewModelManager();
manager.UnregisterViewModelInstance(new InterestingViewModel());
}
示例4: UnregisterViewModelInstance_ExistingViewModel
public void UnregisterViewModelInstance_ExistingViewModel()
{
var manager = new ViewModelManager();
var viewModel = new InterestingViewModel();
manager.RegisterViewModelInstance(viewModel);
manager.UnregisterViewModelInstance(viewModel);
}
示例5: UnregisterViewModelInstance_Null
public void UnregisterViewModelInstance_Null()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.UnregisterViewModelInstance(null));
}
示例6: RegisterViewModelInstance_ViewModel
public void RegisterViewModelInstance_ViewModel()
{
var manager = new ViewModelManager();
manager.RegisterViewModelInstance(new InterestingViewModel());
}
示例7: ReturnsNullForUnregisteredModel
public void ReturnsNullForUnregisteredModel()
{
var model = new Person();
var vmManager = new ViewModelManager();
var foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();
Assert.IsNull(foundVm);
}
示例8: RemoveInterestedViewModelInstance_SecondArgumentNull
public void RemoveInterestedViewModelInstance_SecondArgumentNull()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.RemoveInterestedViewModelInstance(typeof(InterestingViewModel), null));
}
示例9: ReturnsViewModelForMultiRegisteredViewModel
public void ReturnsViewModelForMultiRegisteredViewModel()
{
var firstvm = new TestViewModel(){FirstName = "Rajiv", LastName = "Mounguengue"};
var secondvm = new TestViewModel();
var vmManager = new ViewModelManager();
vmManager.RegisterViewModelInstance(firstvm);
vmManager.RegisterViewModelInstance(secondvm);
var foundvm = vmManager.GetFirstOrDefaultInstance<TestViewModel>();
Assert.AreEqual(firstvm, foundvm);
}
示例10: ReturnsViewModelForRegisteredViewModel
public void ReturnsViewModelForRegisteredViewModel()
{
var vm = new TestViewModel();
var vmManager = new ViewModelManager();
vmManager.RegisterViewModelInstance(vm);
var foundvm = vmManager.GetFirstOrDefaultInstance<TestViewModel>();
Assert.AreEqual(vm, foundvm);
}
示例11: ReturnsNullForUnregisteredViewModel
public void ReturnsNullForUnregisteredViewModel()
{
var vmManager = new ViewModelManager();
var foundvm = vmManager.GetFirstOrDefaultInstance<TestViewModel>();
Assert.IsNull(foundvm);
}
示例12: ReturnsChildViewModelsUsingParentInstance
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));
}
示例13: ReturnsNullForUnregisteredChildViewModels
public void ReturnsNullForUnregisteredChildViewModels()
{
var viewModelManager = new ViewModelManager();
var foundViewModels = viewModelManager.GetChildViewModels(42);
Assert.AreEqual(0, foundViewModels.Count());
}
示例14: AddInterestedViewModelInstance_ViewModelForNotExistingInterestedInViewModel
public void AddInterestedViewModelInstance_ViewModelForNotExistingInterestedInViewModel()
{
var manager = new ViewModelManager();
var interestedViewModel = new InterestedViewModel();
manager.AddInterestedViewModelInstance(typeof(InterestingViewModel), interestedViewModel);
}
示例15: RemoveInterestedViewModelInstance_FirstArgumentNull
public void RemoveInterestedViewModelInstance_FirstArgumentNull()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.RemoveInterestedViewModelInstance(null, null));
}