Beispiel #1
0
        public async Task InsertTest()
        {
            var disciplineId = (await DisciplineDao.FindAllAsync()).First().Id;
            var locationId   = (await LocationDao.FindAllAsync()).First().Id;
            var seasonId     = (await SeasonDao.FindAllAsync()).First().Id;

            var raceId = await RaceDao.InsertGetIdAsync(new Race
            {
                DisciplineId    = disciplineId,
                GenderId        = (int)Domain.Enums.Gender.Male,
                LocationId      = locationId,
                RaceDescription = "Description",
                SeasonId        = seasonId,
                RaceStateId     = (int)Domain.Enums.RaceDataEvent.RaceFinished,
                RaceDate        = new DateTime(2019, 11, 15)
            });

            var raceById = await RaceDao.FindByIdAsync(raceId.Value);

            Assert.AreEqual(disciplineId, raceById.DisciplineId);
            Assert.AreEqual((int)Domain.Enums.Gender.Male, raceById.GenderId);
            Assert.AreEqual(locationId, raceById.LocationId);
            Assert.AreEqual("Description", raceById.RaceDescription);
            Assert.AreEqual(seasonId, raceById.SeasonId);
            Assert.AreEqual((int)Domain.Enums.RaceDataEvent.RaceFinished, raceById.RaceStateId);
            Assert.AreEqual(new DateTime(2019, 11, 15), raceById.RaceDate);
            Assert.NotNull(raceById.Location);
            Assert.NotNull(raceById.Gender);
            Assert.NotNull(raceById.Season);
        }
        public async Task FindById()
        {
            var discipline     = (await DisciplineDao.FindAllAsync()).First();
            var disciplineById = await DisciplineDao.FindByIdAsync(discipline.Id);

            Assert.AreEqual(discipline.DisciplineName, disciplineById?.DisciplineName);
        }
        public async Task RemovePossibleDisciplineTest()
        {
            var location     = (await LocationDao.FindAllAsync()).First();
            var disciplineId = (await DisciplineDao.FindAllAsync()).First().Id;
            await LocationDao.DeletePossibleDisciplineForLocation(location.Id, disciplineId);

            Assert.AreEqual(1, (await LocationDao.GetPossibleDisciplinesForLocation(location.Id)).Count());
        }
        public async Task DeleteAllTest()
        {
            await DbTeardown();

            await DisciplineDao.InsertAsync(new Discipline { DisciplineName = "E" });

            await DisciplineDao.DeleteAllAsync();

            Assert.IsEmpty(await DisciplineDao.FindAllAsync());
        }
        public async Task UpdateTest()
        {
            var discipline = (await DisciplineDao.FindAllAsync()).First();

            discipline.DisciplineName = "ABC";
            await DisciplineDao.UpdateAsync(discipline);

            var disciplineById = await DisciplineDao.FindByIdAsync(discipline.Id);

            Assert.AreEqual("ABC", disciplineById?.DisciplineName);
        }
 public async Task FindAllTest() => Assert.AreEqual(2, (await DisciplineDao.FindAllAsync()).Count());