public void AnHttpResponseExceptionExceptionIsThrownWithBadRequest() { var exception = Assert.Throws <ODataException>( () => TopQueryOptionValidator.Validate(this.queryOptions, this.validationSettings)); Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode); Assert.Equal(Messages.IntRawValueInvalid.FormatWith("$top"), exception.Message); }
public void AnHttpResponseExceptionExceptionIsThrownWithNotImplemented() { var exception = Assert.Throws <ODataException>( () => TopQueryOptionValidator.Validate(this.queryOptions, this.validationSettings)); Assert.Equal(HttpStatusCode.NotImplemented, exception.StatusCode); Assert.Equal(Messages.UnsupportedQueryOption.FormatWith("$top"), exception.Message); }
public void AnHttpResponseExceptionExceptionIsThrownWithBadRequest() { var exception = Assert.Throws <ODataException>( () => TopQueryOptionValidator.Validate(this.queryOptions, this.validationSettings)); Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode); Assert.Equal(Messages.TopValueExceedsMaxAllowed.FormatWith(validationSettings.MaxTop.ToString()), exception.Message); }
public void An_ODataException_IsThrown_WithStatusBadRequest() { ODataException odataException = Assert.Throws <ODataException>( () => TopQueryOptionValidator.Validate(_queryOptions, _validationSettings)); Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode); Assert.Equal("The integer value for $top is invalid, it must be an integer greater than zero and below the max value of 0 allowed by this service", odataException.Message); Assert.Equal("$top", odataException.Target); }
public void An_ODataException_IsThrown_WithStatusNotImplemented() { ODataException odataException = Assert.Throws <ODataException>( () => TopQueryOptionValidator.Validate(_queryOptions, _validationSettings)); Assert.Equal(HttpStatusCode.NotImplemented, odataException.StatusCode); Assert.Equal("The query option $top is not implemented by this service", odataException.Message); Assert.Equal("$top", odataException.Target); }
/// <inheritdoc/> public void Validate(ODataQueryOptions queryOptions, ODataValidationSettings validationSettings) { if (queryOptions is null) { throw new ArgumentNullException(nameof(queryOptions)); } if (validationSettings is null) { throw new ArgumentNullException(nameof(validationSettings)); } CountQueryOptionValidator.Validate(queryOptions, validationSettings); ExpandQueryOptionValidator.Validate(queryOptions, validationSettings); FilterQueryOptionValidator.Validate(queryOptions, validationSettings); FormatQueryOptionValidator.Validate(queryOptions, validationSettings); OrderByQueryOptionValidator.Validate(queryOptions, validationSettings); SearchQueryOptionValidator.Validate(queryOptions, validationSettings); SelectQueryOptionValidator.Validate(queryOptions, validationSettings); SkipQueryOptionValidator.Validate(queryOptions, validationSettings); SkipTokenQueryOptionValidator.Validate(queryOptions, validationSettings); TopQueryOptionValidator.Validate(queryOptions, validationSettings); }
public void AnExceptionShouldNotBeThrown() { TopQueryOptionValidator.Validate(this.queryOptions, this.validationSettings); }
public void NoExceptionIsThrown() { TopQueryOptionValidator.Validate(this.queryOptions, this.validationSettings); }