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

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

            Species entity = new Species();

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

            var record = await repository.All();

            record.Should().NotBeEmpty();
        }