public void GetViewNamespace_With_Default_NamespaceSuffix_Succeeds() { var viewModelType = typeof(ViewModels.SomeViewModel); var targetViewNamespace = typeof(Views.SomeView).Namespace; var viewProvider = new DefaultViewProvider(); var viewNamespace = viewProvider.GetViewNamespace(viewModelType, viewProvider.ViewModelNamespaceSuffix, viewProvider.ViewNamespaceSuffix); Assert.That(viewNamespace, Is.EqualTo(targetViewNamespace)); }
public void GetViewNamespace_Throws() { var viewModelType = typeof(SomeViewModel); var viewProvider = new DefaultViewProvider ( viewModelNamespaceSuffix: Guid.NewGuid().ToString(), // This is not the namespace you are looking for. viewNamespaceSuffix: "", viewModelNameSuffix: "", viewNameSuffix: "" ); // The defined namespace of the view models does not match. Assert.Throws <ViewProviderException>(() => viewProvider.GetViewNamespace(viewModelType, viewProvider.ViewModelNamespaceSuffix, viewProvider.ViewNamespaceSuffix)); }
public void GetViewNamespace_Without_NamespaceSuffix_Succeeds() { var viewModelType = typeof(SomeViewModel); var targetViewNamespace = viewModelType.Namespace; var viewProvider = new DefaultViewProvider ( viewModelNamespaceSuffix: String.Empty, viewNamespaceSuffix: String.Empty, viewModelNameSuffix: "", viewNameSuffix: "" ); var viewNamespace = viewProvider.GetViewNamespace(viewModelType, viewProvider.ViewModelNamespaceSuffix, viewProvider.ViewNamespaceSuffix); Assert.AreEqual(targetViewNamespace, viewNamespace); }