コード例 #1
0
        public async void All()
        {
            Mock <ILogger <PostTypeRepository> > loggerMoc = PostTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PostTypeRepositoryMoc.GetContext();
            var repository = new PostTypeRepository(loggerMoc.Object, context);
            var records    = await repository.All();

            records.Should().NotBeEmpty();
            records.Count.Should().Be(1);
        }
コード例 #2
0
        public async void All()
        {
            Mock <ILogger <PostTypeRepository> > loggerMoc = PostTypeRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PostTypeRepositoryMoc.GetContext();
            var repository = new PostTypeRepository(loggerMoc.Object, context);

            PostType entity = new PostType();

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

            var record = await repository.All();

            record.Should().NotBeEmpty();
        }