Ejemplo n.º 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.");
        }
Ejemplo n.º 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.");
        }
Ejemplo n.º 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);
                }
            }
        }