Пример #1
0
        public void Test_is_valid_with_invalid_football_returns_false(Football football)
        {
            // Arrange.
            // Act.
            var result = football.IsValid(new FootballValidator());

            // Assert.
            result.IsValid.Should().BeFalse("the football data is made up of invalid data.");
        }
Пример #2
0
        public void Test_is_valid_with_valid_football_returns_true(Football football)
        {
            // Arrange.
            // Act.
            var result = football.IsValid();

            // Assert.
            result.IsValid.Should().BeTrue("the football data is all made up of valid data.");
        }
Пример #3
0
        private static void ProcessFootballValidation(this FootballValidatorType isFootballValidType, Football result)
        {
            var validationResult = result.IsValid(new FootballValidator());

            if (validationResult.IsValid)
            {
                isFootballValidType.IsValid  = true;
                isFootballValidType.Football = result;
            }
            else
            {
                isFootballValidType.IsValid = false;
                isFootballValidType.ErrorList.Add($"Invalid Football.");

                foreach (var validationResultError in validationResult.Errors)
                {
                    isFootballValidType.ErrorList.Add(validationResultError.ErrorMessage);
                }
            }
        }