示例#1
0
        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();
        }
示例#3
0
        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);
        }