Ejemplo n.º 1
0
        public void GetSeriesByPartOfDescription_ReturnsListOfSeries()
        {
            var description = RandomUtil.GetRandomString(30);

            SerieCommands.SaveSerie(new Serie {
                Description = description
            }, Context);
            var series = SerieQueries.GetSeriesByPartOfDescription(Context,
                                                                   description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1));

            Assert.IsNotNull(series);
            Assert.IsNotNull(series.FirstOrDefault(s => s.Description == description));
        }
Ejemplo n.º 2
0
        public override void SaveEntity_EntityExists_EntityIsUpdated()
        {
            var competition = CreateCompetition();
            var serie       = SerieCommands.SaveSerie(new Serie {
                Description = RandomUtil.GetRandomString(), IdCompetition = competition.IdCompetition
            }, Context);

            Assert.IsNotNull(serie);

            var teamsToPromote = RandomUtil.GetRandomNumber(1);

            serie.TeamsPromote = teamsToPromote;
            serie.SaveSerie(Context);

            var serieDb = SerieQueries.GetSerieById(Context, serie.IdSerie);

            Assert.IsNotNull(serieDb.TeamsPromote);
            Assert.AreEqual(teamsToPromote, serieDb.TeamsPromote);
        }
Ejemplo n.º 3
0
        public void GetSeriesByIdCompetition_SeriesForThatIdExist_ReturnsAllSeries()
        {
            var competition = CompetitionCommands.SaveCompetition(
                new Competition {
                Name = RandomUtil.GetRandomString(), Description = RandomUtil.GetRandomString(150)
            },
                Context);

            SerieCommands.SaveSerie(new Serie {
                Description = RandomUtil.GetRandomString(), IdCompetition = competition.IdCompetition
            }, Context);
            SerieCommands.SaveSerie(new Serie {
                Description = RandomUtil.GetRandomString(), IdCompetition = competition.IdCompetition
            }, Context);

            var series = SerieQueries.GetSeriesByIdCompetition(Context, competition.IdCompetition);

            Assert.IsNotNull(series);
            Assert.AreEqual(2, series.Count);
        }
Ejemplo n.º 4
0
 public void GetSeriesByIdCompetition_NoSeriesForThatIdExist_ReturnsEmptyList()
 {
     Assert.IsEmpty(SerieQueries.GetSeriesByIdCompetition(Context, -1));
 }
Ejemplo n.º 5
0
 public override void GetEntityById_EntityDoesNotExist_ReturnsNull()
 {
     Assert.IsNull(SerieQueries.GetSerieById(Context, -1));
 }