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