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 + ' ')); } }
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)); } }
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()); } }