public void DeleteNotFound()
        {
            Mock <ILogger <PipelineStepNoteRepository> > loggerMoc = PipelineStepNoteRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepNoteRepositoryMoc.GetContext();
            var repository = new PipelineStepNoteRepository(loggerMoc.Object, context);

            Func <Task> delete = async() =>
            {
                await repository.Delete(default(int));
            };

            delete.Should().NotThrow();
        }
Пример #2
0
        public async void Delete()
        {
            Mock <ILogger <PipelineStepNoteRepository> > loggerMoc = PipelineStepNoteRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepNoteRepositoryMoc.GetContext();
            var repository          = new PipelineStepNoteRepository(loggerMoc.Object, context);
            PipelineStepNote entity = new PipelineStepNote();

            context.Set <PipelineStepNote>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.Id);

            PipelineStepNote modifiedRecord = await context.Set <PipelineStepNote>().FirstOrDefaultAsync();

            modifiedRecord.Should().BeNull();
        }
        public async void DeleteFound()
        {
            Mock <ILogger <PipelineStepNoteRepository> > loggerMoc = PipelineStepNoteRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepNoteRepositoryMoc.GetContext();
            var repository          = new PipelineStepNoteRepository(loggerMoc.Object, context);
            PipelineStepNote entity = new PipelineStepNote();

            entity.SetProperties(default(int), 1, "B", 1);
            context.Set <PipelineStepNote>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.Id);

            var records = await context.Set <PipelineStepNote>().ToListAsync();

            records.Count.Should().Be(1);
        }