public void EvalThrowsIfExpressionIsNullOrEmpty(string expression) { // Arrange var viewData = new ViewDataDictionary(new EmptyModelMetadataProvider()); // Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => viewData.Eval(expression), "expression"); }
public void FindView_ThrowsIfViewNameIsNullOrEmpty(string viewName) { // Arrange var viewEngine = CreateViewEngine(); var context = GetActionContext(_controllerTestContext); // Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => viewEngine.FindView(context, viewName), "viewName"); }
public void Redirect_WithParameter_NullOrEmptyUrl_Throws(string url) { // Arrange var controller = new Controller(); // Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty( () => controller.Redirect(url: url), "url"); }
public void PasswordWithEmptyNameAndPrefixThrows() { // Arrange var helper = DefaultTemplatesUtilities.GetHtmlHelper(GetViewDataWithModelStateAndModelAndViewDataValues()); var name = string.Empty; var value = string.Empty; // Act and Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => helper.Password(name, value, htmlAttributes: null), "expression"); }
public void FormatterMappings_SetFormatMapping_FormatEmpty() { // Arrange var options = new FormatterMappings(); var format = ""; // Act and Assert ExceptionAssert.ThrowsArgumentNullOrEmpty( () => options.SetMediaTypeMappingForFormat( format, MediaTypeHeaderValue.Parse("application/xml")), "format"); }
public void HiddenWithEmptyNameAndPrefixThrows() { // Arrange var helper = DefaultTemplatesUtilities.GetHtmlHelper(GetViewDataWithModelStateAndModelAndViewDataValues()); var attributes = new Dictionary <string, object> { { "class", "some-class" } }; // Act and Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => helper.Hidden(string.Empty, string.Empty, attributes), "expression"); }
public void GetMetadataForPropertyNullOrEmptyPropertyNameThrows() { // Arrange var provider = new TestableAssociatedMetadataProvider(); // Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty( () => provider.GetMetadataForProperty(modelAccessor: null, containerType: typeof(object), propertyName: null), "propertyName"); ExceptionAssert.ThrowsArgumentNullOrEmpty( () => provider.GetMetadataForProperty(modelAccessor: null, containerType: typeof(object), propertyName: String.Empty), "propertyName"); }
public void GetMetadataForParameterNullOrEmptyPropertyNameThrows() { // Arrange var provider = new TestableAssociatedMetadataProvider(); // Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty( () => provider.GetMetadataForParameter(modelAccessor: null, methodInfo: null, parameterName: null), "parameterName"); ExceptionAssert.ThrowsArgumentNullOrEmpty( () => provider.GetMetadataForParameter(modelAccessor: null, methodInfo: null, parameterName: null), "parameterName"); }
public void CtorSearchQueryOption_ThrowsArgumentNull_ForInputParameter() { // Arrange & Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => new SearchQueryOption(null, null, null), "rawValue"); ExceptionAssert.ThrowsArgumentNullOrEmpty(() => new SearchQueryOption(string.Empty, null, null), "rawValue"); // Arrange & Act & Assert ExceptionAssert.ThrowsArgumentNull(() => new SearchQueryOption("any", null, null), "context"); // Arrange & Act & Assert ODataQueryContext context = new ODataQueryContext(EdmCoreModel.Instance, typeof(int)); ExceptionAssert.ThrowsArgumentNull(() => new SearchQueryOption("any", context, null), "queryOptionParser"); }
public void AddSelector_ThrowsArgumentNull_ForInputParameter() { // Arrange & Act & Assert ActionModel action = null; ExceptionAssert.ThrowsArgumentNull(() => action.AddSelector(null, null, null, null), "action"); // Arrange & Act & Assert MethodInfo methodInfo = typeof(TestController).GetMethod("Get"); action = methodInfo.BuildActionModel(); ExceptionAssert.ThrowsArgumentNullOrEmpty(() => action.AddSelector(null, null, null, null), "httpMethods"); // Arrange & Act & Assert string httpMethods = "get"; ExceptionAssert.ThrowsArgumentNull(() => action.AddSelector(httpMethods, null, null, null), "model"); // Arrange & Act & Assert IEdmModel model = new Mock <IEdmModel>().Object; ExceptionAssert.ThrowsArgumentNull(() => action.AddSelector(httpMethods, null, model, null), "path"); }
public void Ctor_ThrowsArgumentNull_Template() { // Assert & Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => new ODataRoutePrefixAttribute(template: null), "template"); }
public void CtorSkipTokenQueryOption_ThrowsArgumentNullOrEmpty_RawValue(string rawValue) { // Arrange & Act & Assert ExceptionAssert.ThrowsArgumentNullOrEmpty(() => new SkipTokenQueryOption(rawValue, null), "rawValue"); }