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