Exemple #1
0
        public void Validate_ReturnFalse_WhenContractNumberIsEmpty()
        {
            var command = new AddCommand
            {
                Name           = "Tender Number",
                ContractNumber = string.Empty,
            };

            var validator = new AddCommandValidator(_configConstants);
            var result    = validator.Validate(command);

            result.Errors.FirstOrDefault(x => x.ErrorMessage == _configConstants.INVALID_TENDER_CONTRACT_NUMBER)?.ErrorMessage.ShouldBe(_configConstants.INVALID_TENDER_CONTRACT_NUMBER);
            result.IsValid.ShouldBeFalse();
        }
Exemple #2
0
        public void Validate_ReturnTrue_WhenDataIsValid()
        {
            var command = new AddCommand
            {
                Name           = "Tender Name",
                ContractNumber = "Contract Number",
                ReleaseDate    = DateTime.Today.ToString("yyyy-MM-dd"),
                ClosingDate    = DateTime.Today.AddMonths(1).ToString("yyyy-MM-dd"),
                Description    = "Tender Description",
            };

            var validator = new AddCommandValidator(_configConstants);
            var result    = validator.Validate(command);

            result.IsValid.ShouldBeTrue();
        }