Exemplo n.º 1
0
        public ValidationOutput Validate(Ball input)
        {
            var errors = new List <ValidationError>();

            if (input.Price <= 0)
            {
                errors.Add(ValidationError.Create($"{input.Name} : Ball price needs to be larger than 0, we'll go bankrupt if we give shit away for free."));
            }

            if (input.Price > 1000)
            {
                errors.Add(ValidationError.Create($"{input.Name} : No ball is that expensive ({input.Price}), it needs to be less than 1000."));
            }

            return(ValidationOutput.Create(errors));
        }
Exemplo n.º 2
0
        public ValidationOutput Validate(Ball input)
        {
            var errors = new List <ValidationError>();

            if (input.Size < 2)
            {
                errors.Add(ValidationError.Create($"{input.Name} : Ball is too small, it needs to be larger than 2."));
            }

            if (input.Size > 10)
            {
                errors.Add(ValidationError.Create($"{input.Name} : Ball is too large, it needs to be smaller than 10."));
            }

            return(ValidationOutput.Create(errors));
        }