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

            var entity = new IncludedColumnTest();
            await repository.Create(entity);

            var record = await context.Set <IncludedColumnTest>().FirstOrDefaultAsync();

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

            var entity = new IncludedColumnTest();

            entity.SetProperties(default(int), "B", "B");
            await repository.Create(entity);

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

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