public void When_NameIsSet_Then_NoValidationError()
        {
            var command = new GetCompetitionQuery
            {
                Name = "Premier League"
            };

            var validator = new GetCompetitionQueryValidator();

            validator.ShouldNotHaveValidationErrorFor(x => x.Name, command);
        }
        public void When_NameIsEmpty_Then_ValidationError()
        {
            var command = new GetCompetitionQuery
            {
                Name = ""
            };

            var validator = new GetCompetitionQueryValidator();

            validator.ShouldHaveValidationErrorFor(x => x.Name, command);
        }
Exemple #3
0
        public async Task <Application.Competitions.Queries.GetCompetition.CompetitionDto> GetCompetition(GetCompetitionQuery query)
        {
            var response = await httpRequestFactory.Get($"{apiSettings.CompetitionApiUrl}/{query.Name}");

            if (response.IsSuccessStatusCode)
            {
                return(response.ContentAsType <Application.Competitions.Queries.GetCompetition.CompetitionDto>());
            }
            return(new Application.Competitions.Queries.GetCompetition.CompetitionDto());
        }