本文整理汇总了C#中ViewModelManager类的典型用法代码示例。如果您正苦于以下问题:C# ViewModelManager类的具体用法?C# ViewModelManager怎么用?C# ViewModelManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewModelManager类属于命名空间,在下文中一共展示了ViewModelManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ThrowsArgumentNullExceptionForNullViewModel
public void ThrowsArgumentNullExceptionForNullViewModel()
{
var model = new Person();
var vmManager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => vmManager.UnregisterModel(null, model));
}
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:ViewModelManagerTest.cs
示例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);
}
开发者ID:justdude,项目名称:DbExport,代码行数:13,代码来源:ViewModelManagerTest.cs
示例3: UnregisterViewModelInstance_NotExistingViewModel
public void UnregisterViewModelInstance_NotExistingViewModel()
{
var manager = new ViewModelManager();
manager.UnregisterViewModelInstance(new InterestingViewModel());
}
开发者ID:justdude,项目名称:DbExport,代码行数:5,代码来源:ViewModelManagerTest.cs
示例4: UnregisterViewModelInstance_ExistingViewModel
public void UnregisterViewModelInstance_ExistingViewModel()
{
var manager = new ViewModelManager();
var viewModel = new InterestingViewModel();
manager.RegisterViewModelInstance(viewModel);
manager.UnregisterViewModelInstance(viewModel);
}
开发者ID:justdude,项目名称:DbExport,代码行数:8,代码来源:ViewModelManagerTest.cs
示例5: UnregisterViewModelInstance_Null
public void UnregisterViewModelInstance_Null()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.UnregisterViewModelInstance(null));
}
开发者ID:justdude,项目名称:DbExport,代码行数:6,代码来源:ViewModelManagerTest.cs
示例6: RegisterViewModelInstance_ViewModel
public void RegisterViewModelInstance_ViewModel()
{
var manager = new ViewModelManager();
manager.RegisterViewModelInstance(new InterestingViewModel());
}
开发者ID:justdude,项目名称:DbExport,代码行数:5,代码来源:ViewModelManagerTest.cs
示例7: ReturnsNullForUnregisteredModel
public void ReturnsNullForUnregisteredModel()
{
var model = new Person();
var vmManager = new ViewModelManager();
var foundVm = vmManager.GetViewModelsOfModel(model).FirstOrDefault();
Assert.IsNull(foundVm);
}
开发者ID:justdude,项目名称:DbExport,代码行数:9,代码来源:ViewModelManagerTest.cs
示例8: RemoveInterestedViewModelInstance_SecondArgumentNull
public void RemoveInterestedViewModelInstance_SecondArgumentNull()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.RemoveInterestedViewModelInstance(typeof(InterestingViewModel), null));
}
开发者ID:justdude,项目名称:DbExport,代码行数:6,代码来源:ViewModelManagerTest.cs
示例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);
}
开发者ID:justdude,项目名称:DbExport,代码行数:12,代码来源:ViewModelManagerTest.cs
示例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);
}
开发者ID:justdude,项目名称:DbExport,代码行数:10,代码来源:ViewModelManagerTest.cs
示例11: ReturnsNullForUnregisteredViewModel
public void ReturnsNullForUnregisteredViewModel()
{
var vmManager = new ViewModelManager();
var foundvm = vmManager.GetFirstOrDefaultInstance<TestViewModel>();
Assert.IsNull(foundvm);
}
开发者ID:justdude,项目名称:DbExport,代码行数:8,代码来源:ViewModelManagerTest.cs
示例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));
}
开发者ID:justdude,项目名称:DbExport,代码行数:17,代码来源:ViewModelManagerTest.cs
示例13: ReturnsNullForUnregisteredChildViewModels
public void ReturnsNullForUnregisteredChildViewModels()
{
var viewModelManager = new ViewModelManager();
var foundViewModels = viewModelManager.GetChildViewModels(42);
Assert.AreEqual(0, foundViewModels.Count());
}
开发者ID:justdude,项目名称:DbExport,代码行数:8,代码来源:ViewModelManagerTest.cs
示例14: AddInterestedViewModelInstance_ViewModelForNotExistingInterestedInViewModel
public void AddInterestedViewModelInstance_ViewModelForNotExistingInterestedInViewModel()
{
var manager = new ViewModelManager();
var interestedViewModel = new InterestedViewModel();
manager.AddInterestedViewModelInstance(typeof(InterestingViewModel), interestedViewModel);
}
开发者ID:justdude,项目名称:DbExport,代码行数:8,代码来源:ViewModelManagerTest.cs
示例15: RemoveInterestedViewModelInstance_FirstArgumentNull
public void RemoveInterestedViewModelInstance_FirstArgumentNull()
{
var manager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => manager.RemoveInterestedViewModelInstance(null, null));
}
开发者ID:justdude,项目名称:DbExport,代码行数:6,代码来源:ViewModelManagerTest.cs
示例16: ShouldFailsDueToANonIViewModelType
public void ShouldFailsDueToANonIViewModelType()
{
var viewModelManager = new ViewModelManager();
ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => viewModelManager.GetFirstOrDefaultInstance(typeof(Type)));
}
开发者ID:justdude,项目名称:DbExport,代码行数:6,代码来源:ViewModelManagerTest.cs
示例17: RemoveInterestedViewModelInstance_ViewModelForNotRegisteredInterestedInViewModel
public void RemoveInterestedViewModelInstance_ViewModelForNotRegisteredInterestedInViewModel()
{
var manager = new ViewModelManager();
var interestedViewModel = new InterestedViewModel();
manager.RemoveInterestedViewModelInstance(typeof(InterestingViewModel), interestedViewModel);
}
开发者ID:justdude,项目名称:DbExport,代码行数:8,代码来源:ViewModelManagerTest.cs
示例18: MustBeNotNullAfterConstructed
public void MustBeNotNullAfterConstructed()
{
var vmManager = new ViewModelManager();
Assert.IsNotNull(vmManager.ActiveViewModels);
}
开发者ID:justdude,项目名称:DbExport,代码行数:6,代码来源:ViewModelManagerTest.cs
示例19: MustExistsForRegisteredViewModels
public void MustExistsForRegisteredViewModels()
{
var firstvm = new TestViewModel();
var secondvm = new TestViewModel();
var vmManager = new ViewModelManager();
vmManager.RegisterViewModelInstance(firstvm);
vmManager.RegisterViewModelInstance(secondvm);
var vmList = vmManager.ActiveViewModels.ToList();
Assert.IsTrue(vmList.Any(vm => TagHelper.AreTagsEqual(vm.UniqueIdentifier, firstvm.UniqueIdentifier)));
Assert.IsTrue(vmList.Any(vm => TagHelper.AreTagsEqual(vm.UniqueIdentifier, secondvm.UniqueIdentifier)));
}
开发者ID:justdude,项目名称:DbExport,代码行数:14,代码来源:ViewModelManagerTest.cs
示例20: UnregistersAllModelForViewModel
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);
}
开发者ID:justdude,项目名称:DbExport,代码行数:19,代码来源:ViewModelManagerTest.cs
注:本文中的ViewModelManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论