public void Input_With_InCorrect7FigureCode_ReturnsInValid_For_LuhnModN_Check(string pubTek)
        {
            // Arrange
            var validator = new PublishTekArgsValidator(new LuhnModNValidator(new LuhnModNConfig()), new StandardUtcDateTimeProvider());
            var args      = new PublishTekArgs
            {
                GGDKey       = pubTek,
                SelectedDate = DateTime.Today,
                Symptomatic  = true
            };

            // Act
            var errorMessages = validator.Validate(args);

            // Assert
            Assert.False(errorMessages.Length == 0);
        }
예제 #2
0
        public async Task <PublishTekResponse> ExecuteAsync(PublishTekArgs args)
        {
            var response = new PublishTekResponse();

            // Validates the given PubTEK input. If there are errors, set response valid value to false.
            var errors = _publishTekArgsValidator.Validate(args);

            if (errors.Any())
            {
                _logger.LogValidationMessages(errors);
                response.Valid = false;
            }
            else
            {
                // If valid, try to publish the TEK.
                response.Valid = await _publishTekCommand.ExecuteAsync(args);
            }

            // Return a response with only true or false. No further information should be send to the client.
            return(response);
        }