public async void Get()
        {
            Mock <ILogger <PipelineStepRepository> > loggerMoc = PipelineStepRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepRepositoryMoc.GetContext();
            var repository = new PipelineStepRepository(loggerMoc.Object, context);

            PipelineStep entity = new PipelineStep();

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

            var record = await repository.Get(entity.Id);

            record.Should().NotBeNull();
        }
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <PipelineStepRepository> > loggerMoc = PipelineStepRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepRepositoryMoc.GetContext();
            var          repository      = new PipelineStepRepository(loggerMoc.Object, context);
            PipelineStep entity          = new PipelineStep();

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

            var record = await repository.Get(entity.Id);

            await repository.Update(record);

            var modifiedRecord = context.Set <PipelineStep>().FirstOrDefaultAsync();

            modifiedRecord.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <PipelineStepRepository> > loggerMoc = PipelineStepRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepRepositoryMoc.GetContext();
            var          repository      = new PipelineStepRepository(loggerMoc.Object, context);
            PipelineStep entity          = new PipelineStep();

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

            var record = await repository.Get(entity.Id);

            await repository.Update(record);

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

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