public void IsValidShouldBeTrueWhenNoErrorIsProvidedWithController() { // arrange ODataException error = null; var controller = new Mock <ApiController>().Object; var result = new ODataQueryValidationResult(error, controller); var expected = true; // act var actual = result.IsValid; // assert Assert.Equal(expected, actual); }
public void IsValidShouldBeFalseWhenErrorIsProvidedWithController() { // arrange var error = new ODataException("Failed validation."); var controller = new Mock <ApiController>().Object; var result = new ODataQueryValidationResult(error, controller); var expected = false; // act var actual = result.IsValid; // assert Assert.Equal(expected, actual); }
public void IsValidShouldBeTrueWhenNoErrorIsProvidedWithoutController() { // arrange ODataException error = null; var contentNegotiator = new Mock <IContentNegotiator>().Object; var request = new HttpRequestMessage(); var formatters = Enumerable.Empty <MediaTypeFormatter>(); var result = new ODataQueryValidationResult(error, contentNegotiator, request, formatters); var expected = true; // act var actual = result.IsValid; // assert Assert.Equal(expected, actual); }