public async void Delete() { 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(); await repository.Delete(entity.LocationID); Location modifiedRecord = await context.Set <Location>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_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(); await repository.Update(new Location()); var modifiedRecord = context.Set <Location>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }