public void TestValidate_ValidDescOrderBy_NoValidationError( GetProductsQueryValidator sut, GetProductsQuery query ) { //Arrange query.OrderBy = "desc(name)"; //Act var result = sut.TestValidate(query); //Assert result.ShouldNotHaveValidationErrorFor(query => query.OrderBy); }
public void TestValidate_NoClosingBracketOrderBy_ValidationError( GetProductsQueryValidator sut, GetProductsQuery query ) { //Arrange query.OrderBy = "asc(name"; //Act var result = sut.TestValidate(query); //Assert result.ShouldHaveValidationErrorFor(query => query.OrderBy) .WithErrorMessage("Order by is not valid"); }
public void TestValidate_InvalidDirectionOrderBy_ValidationError( GetProductsQueryValidator sut, GetProductsQuery query ) { //Arrange query.OrderBy = "fail(name)"; //Act var result = sut.TestValidate(query); //Assert result.ShouldHaveValidationErrorFor(query => query.OrderBy) .WithErrorMessage("Order by is not valid"); }