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