public async void Get() { Mock <ILogger <CountryRegionRepository> > loggerMoc = CountryRegionRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CountryRegionRepositoryMoc.GetContext(); var repository = new CountryRegionRepository(loggerMoc.Object, context); CountryRegion entity = new CountryRegion(); context.Set <CountryRegion>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.CountryRegionCode); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <CountryRegionRepository> > loggerMoc = CountryRegionRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = CountryRegionRepositoryMoc.GetContext(); var repository = new CountryRegionRepository(loggerMoc.Object, context); CountryRegion entity = new CountryRegion(); context.Set <CountryRegion>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.CountryRegionCode); await repository.Update(record); var modifiedRecord = context.Set <CountryRegion>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }