public void IsValidFallbackTests() { var attribute = new RequiredHttpAttribute(); Assert.IsTrue(attribute.IsValid("A")); Assert.IsTrue(attribute.IsValid("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); Assert.IsFalse(attribute.IsValid(" ")); Assert.IsFalse(attribute.IsValid(null)); Assert.IsFalse(attribute.IsValid(string.Empty)); }
public void IsValidIgnoreRequiredTests() { var attribute = new RequiredHttpAttribute() { HttpMethod = "POST" }; HttpRequest request = new HttpRequest("test", "http://localhost", string.Empty) { RequestType = "Get" }; HttpContext context = new HttpContext(request, null); Assert.IsTrue(attribute.IsValid("A")); Assert.IsTrue(attribute.IsValid("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); Assert.IsTrue(attribute.IsValid(" ")); Assert.IsTrue(attribute.IsValid(null)); Assert.IsTrue(attribute.IsValid(string.Empty)); }
public void IsValidRequiredTests() { var attribute = new RequiredHttpAttribute() { HttpMethod = "GET" }; HttpRequest request = new HttpRequest("test", "http://localhost", string.Empty) { RequestType = "GET" }; HttpResponse response = new HttpResponse(HttpWriter.Null); HttpContext.Current = new HttpContext(request, response); Assert.IsTrue(attribute.IsValid("A")); Assert.IsTrue(attribute.IsValid("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); Assert.IsFalse(attribute.IsValid(" ")); Assert.IsFalse(attribute.IsValid(null)); Assert.IsFalse(attribute.IsValid(string.Empty)); }