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

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

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

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

            var entity = new TimestampCheck();

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

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

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