コード例 #1
0
        public async void Get()
        {
            Mock <ILogger <PipelineStepStatuRepository> > loggerMoc = PipelineStepStatuRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatuRepositoryMoc.GetContext();
            var repository = new PipelineStepStatuRepository(loggerMoc.Object, context);

            PipelineStepStatu entity = new PipelineStepStatu();

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

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

            record.Should().NotBeNull();
        }
コード例 #2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <PipelineStepStatuRepository> > loggerMoc = PipelineStepStatuRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PipelineStepStatuRepositoryMoc.GetContext();
            var repository           = new PipelineStepStatuRepository(loggerMoc.Object, context);
            PipelineStepStatu entity = new PipelineStepStatu();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }