Ejemplo n.º 1
0
        public async Task FindByIdTest()
        {
            var skierEvent     = (await SkierEventDao.FindAllAsync()).First();
            var skierEventById = await SkierEventDao.FindByIdAsync(skierEvent.Id);

            Assert.AreEqual(skierEvent.RaceData?.EventTypeId, skierEventById?.RaceData?.EventTypeId);
            Assert.NotNull(skierEventById?.StartList);
        }
Ejemplo n.º 2
0
        public async Task UpdateTest()
        {
            var skierEvent = (await SkierEventDao.FindAllAsync()).First();
            var skierId    = (await SkierDao.FindAllAsync()).First().Id;

            skierEvent.SkierId = skierId;
            await SkierEventDao.UpdateAsync(skierEvent);

            Assert.AreEqual(skierEvent.SkierId, (await SkierEventDao.FindByIdAsync(skierEvent.Id))?.SkierId);
        }
Ejemplo n.º 3
0
        public async Task GetStartTimeForStartListTest()
        {
            var skierEvents = await SkierEventDao.FindAllAsync();

            var startEvent = skierEvents.First(sk => sk.RaceData.EventTypeId == 8);

            startEvent.RaceData.EventDateTime = DateTime.Today;
            await RaceDataDao.UpdateAsync(startEvent.RaceData);

            Assert.AreEqual(DateTime.Today,
                            (await TimeDataDao.GetStartTimeForStartList(startEvent.SkierId, startEvent.RaceId)).Value);
        }
Ejemplo n.º 4
0
        public async Task InsertTest()
        {
            var skier        = (await SkierDao.FindAllAsync()).First();
            var race         = (await RaceDao.FindAllAsync()).First();
            var skierEventId = (await SkierEventDao.FindAllAsync()).First().Id;
            var newSensorId  =
                await SensorDao.InsertGetIdAsync(new Sensor { RaceId = race.Id, SensorNumber = 0 });

            await TimeDataDao.InsertAsync(new TimeData
            {
                SkierEventId = skierEventId,
                RaceId       = race.Id,
                SensorId     = newSensorId.Value,
                Time         = new DateTime(2019, 11, 6).Millisecond,
                SkierId      = skier.Id
            });

            var timeData = await TimeDataDao.FindByIdAsync(skier.Id, race.Id, newSensorId.Value);

            Assert.NotNull(timeData);
            Assert.AreEqual(new DateTime(2019, 11, 6).Millisecond, timeData?.Time);
        }
Ejemplo n.º 5
0
 public async Task Test() => Assert.AreEqual(30, (await SkierEventDao.FindAllAsync()).Count());