public void DeleteNotFound() { Mock <ILogger <PipelineStepStepRequirementRepository> > loggerMoc = PipelineStepStepRequirementRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStepStepRequirementRepositoryMoc.GetContext(); var repository = new PipelineStepStepRequirementRepository(loggerMoc.Object, context); Func <Task> delete = async() => { await repository.Delete(default(int)); }; delete.Should().NotThrow(); }
public async void Delete() { Mock <ILogger <PipelineStepStepRequirementRepository> > loggerMoc = PipelineStepStepRequirementRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStepStepRequirementRepositoryMoc.GetContext(); var repository = new PipelineStepStepRequirementRepository(loggerMoc.Object, context); PipelineStepStepRequirement entity = new PipelineStepStepRequirement(); context.Set <PipelineStepStepRequirement>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); PipelineStepStepRequirement modifiedRecord = await context.Set <PipelineStepStepRequirement>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void DeleteFound() { Mock <ILogger <PipelineStepStepRequirementRepository> > loggerMoc = PipelineStepStepRequirementRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PipelineStepStepRequirementRepositoryMoc.GetContext(); var repository = new PipelineStepStepRequirementRepository(loggerMoc.Object, context); PipelineStepStepRequirement entity = new PipelineStepStepRequirement(); entity.SetProperties(default(int), "B", 1, true); context.Set <PipelineStepStepRequirement>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); var records = await context.Set <PipelineStepStepRequirement>().ToListAsync(); records.Count.Should().Be(1); }