Пример #1
0
        public async void DoesSportExist_addSportReturnFalse()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.False(repository.DoesSportExist(sport.SportName + ' '));
            }
        }
Пример #2
0
        public async void SportIdExists_ReturnTrue()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.True(repository.SportIdExists(sport.SportId));
            }
        }
Пример #3
0
        public async void AddAsync_AddAsyncToConext()
        {
            var sport = SportGenerator.Create();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                var repository = new SportRepository(context);
                await repository.AddAsync(sport);

                Assert.Equal(1, await context.Sport.CountAsync());
                Assert.Equal(sport, await context.Sport.SingleAsync());
            }
        }