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