public void ShouldContainNoErrors()
        {
            // Arrange
            var command = new CreateOperationalDepartmentCommand("Code", "Name", "Site", "Source");

            // Act
            var validationResult = _validator.Validate(command);
            var exists           = validationResult.Errors.Count > 0;

            // Assert
            exists.Should().BeFalse();
        }
        public void ShouldHaveSourceMandatoryValidationFailureWhenSourceIsEmpty()
        {
            // Arrange
            string source = string.Empty;

            var command = new CreateOperationalDepartmentCommand("Code", "Name", "Site", source);

            // Act
            var validationResult = _validator.Validate(command);
            var exists           =
                validationResult.Errors.Any(
                    a => a.PropertyName.Equals("Source") && a.ErrorMessage.Contains(ValidationFailures.OperationalDepartmentSourceMandatory));

            // Assert
            exists.Should().BeTrue();
        }
Esempio n. 3
0
        public CreateOperationalDepartmentCommand Map(CreateOperationalDepartmentRequest request)
        {
            var result = new CreateOperationalDepartmentCommand(request.BodyCode, request.BodyName, request.BodySite, request.BodySource);

            return(result);
        }