public When_ProvisionGapRepository_GetSingleOrDefault_Is_Called_With_Non_Existent_Id() { var logger = Substitute.For <ILogger <GenericRepository <Domain.Models.ProvisionGap> > >(); using var dbContext = InMemoryDbContext.Create(); dbContext.Add(new ValidProvisionGapBuilder().Build()); dbContext.SaveChanges(); var repository = new GenericRepository <Domain.Models.ProvisionGap>(logger, dbContext); _result = repository.GetSingleOrDefaultAsync(x => x.Id == 2) .GetAwaiter().GetResult(); }
public When_ProvisionGapRepository_Update_Is_Called() { var logger = Substitute.For <ILogger <GenericRepository <Domain.Models.ProvisionGap> > >(); using var dbContext = InMemoryDbContext.Create(); var entity = new ValidProvisionGapBuilder().Build(); dbContext.Add(entity); dbContext.SaveChanges(); var repository = new GenericRepository <Domain.Models.ProvisionGap>(logger, dbContext); entity.NoSuitableStudent = false; entity.HadBadExperience = true; entity.ProvidersTooFarAway = false; entity.ModifiedOn = new DateTime(2019, 11, 01, 12, 30, 00); entity.ModifiedBy = "UpdateTestUser"; repository.UpdateAsync(entity).GetAwaiter().GetResult(); _result = repository.GetSingleOrDefaultAsync(x => x.Id == 1) .GetAwaiter().GetResult(); }