public void ShouldContainNoErrors() { // Arrange var command = new CreateDamageCodeCommand("Code", "Name", "true", "Source"); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Count > 0; // Assert exists.Should().BeFalse(); }
public void ShouldHaveDamageCodeSourceMandatoryValidationFailureWhenSourceIsNull() { // Arrange string source = null; var command = new CreateDamageCodeCommand("Code", "Name", "true", source); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Any( a => a.PropertyName.Equals("Source") && a.ErrorMessage.Contains(ValidationFailures.DamageCodeSourceMandatory)); // Assert exists.Should().BeTrue(); }
public void ShouldHaveDamageCodeDamagedQuantityNotBooleanMandatoryValidationFailureWhenDamagedQuantityRequiredIsNotBoolean() { // Arrange string damagedQuantityRequired = "notBoolean"; var command = new CreateDamageCodeCommand("Code", "Name", damagedQuantityRequired, "Source"); // Act var validationResult = _validator.Validate(command); var exists = validationResult.Errors.Any( a => a.PropertyName.Equals("DamagedQuantityNotBoolean") && a.ErrorMessage.Contains(ValidationFailures.DamageCodeIsNotBoolean)); // Assert exists.Should().BeTrue(); }
public CreateDamageCodeCommand Map(CreateDamageCodeRequest request) { var result = new CreateDamageCodeCommand(request.BodyCode, request.BodyName, request.BodyDamagedQuantityRequired, request.BodySource); return(result); }