public void ShouldContainNoErrors(string description, string image) { // Arrange var name = "name"; var command = new CreateLayoutCommand(name, description, image); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Count > 0; // Assert exists.Should().BeFalse(); }
public void ShouldHaveLayoutNameCannotStartOrEndWithWhiteSpaceValidationErrorWhenNameStartsOrEndsWithWhiteSpace(string symbols) { // Arrange var name = symbols; var description = "description"; var image = "image"; var command = new CreateLayoutCommand(name, description, image); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Any(a => a.PropertyName.Equals("Name") && a.ErrorMessage.Contains(ValidationFailures.LayoutNameCannotStartOrEndWithWhiteSpace)); // Assert exists.Should().BeTrue(); }
public void ShouldHaveLayoutNameMandatoryValidationFailureWhenNameIsNull() { // Arrange string name = null; var description = "description"; var image = "image"; var command = new CreateLayoutCommand(name, description, image); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Any( a => a.PropertyName.Equals("Name") && a.ErrorMessage.Contains(ValidationFailures.LayoutNameMandatory)); // Assert exists.Should().BeTrue(); }
public CreateLayoutCommand Map(CreateLayoutRequest request) { var result = new CreateLayoutCommand(request.BodyName, request.BodyDescription, request.BodyImage); return(result); }