Пример #1
0
 public RoundService(IRoundRepository roundRepo,
                     IMatchRepository matchRepo)
 {
     _roundRepo = roundRepo;
     _matchRepo = matchRepo;
     _roundVali = new RoundValidator();
 }
Пример #2
0
        public override ValidationResult Validate()
        {
            var roundValidator   = new RoundValidator();
            var validationResult = roundValidator.Validate(this);

            SetValidationResult(validationResult);

            return(validationResult);
        }
Пример #3
0
        public void TestExceptionThrownWhenRoundNumberIsLessThanOne(int roundNumber)
        {
            RoundValidator rv    = new RoundValidator();
            var            round = new Round
            {
                RoundNumber = roundNumber
            };

            Assert.Throws <InvalidDataException>(() => rv.ValidateRound(round));
        }
Пример #4
0
        public Round Create(double x, double y, double radius, out IEnumerable <ValidationFailure> listError)
        {
            var validator = new RoundValidator();
            var tempRound = new Round(x, y, radius);

            var result = validator.Validate(tempRound);

            if (result.IsValid == false)
            {
                listError = result.Errors;
                return(null);
            }

            listError = new List <ValidationFailure>();

            return(tempRound);
        }