public async void Create() { Mock <ILogger <MachineRefTeamRepository> > loggerMoc = MachineRefTeamRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = MachineRefTeamRepositoryMoc.GetContext(); var repository = new MachineRefTeamRepository(loggerMoc.Object, context); var entity = new MachineRefTeam(); await repository.Create(entity); var record = await context.Set <MachineRefTeam>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
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 Delete() { 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(); await repository.Delete(entity.Id); MachineRefTeam modifiedRecord = await context.Set <MachineRefTeam>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_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(); await repository.Update(new MachineRefTeam()); var modifiedRecord = context.Set <MachineRefTeam>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }