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 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)); }