public RoundService(IRoundRepository roundRepo,
                     IMatchRepository matchRepo)
 {
     _roundRepo = roundRepo;
     _matchRepo = matchRepo;
     _roundVali = new RoundValidator();
 }
Esempio n. 2
0
        public override ValidationResult Validate()
        {
            var roundValidator   = new RoundValidator();
            var validationResult = roundValidator.Validate(this);

            SetValidationResult(validationResult);

            return(validationResult);
        }
Esempio n. 3
0
        public void TestExceptionThrownWhenRoundNumberIsLessThanOne(int roundNumber)
        {
            RoundValidator rv    = new RoundValidator();
            var            round = new Round
            {
                RoundNumber = roundNumber
            };

            Assert.Throws <InvalidDataException>(() => rv.ValidateRound(round));
        }
Esempio n. 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);
        }