public async void Get()
        {
            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();

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

            record.Should().NotBeNull();
        }
        public async void Update_Entity_Is_Tracked()
        {
            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();

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async void Update_Entity_Is_Tracked()
        {
            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();

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

            await repository.Update(record);

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

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