public async Task GetMaxPage_CorrectPage(int numberOfEntries, int expectedMaxPage) { // Arrange var _options = new DbContextOptionsBuilder <AcmeCorpContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; AcmeCorpContext DbContext = new AcmeCorpContext(_options); _fixture.Customize <Contestant>(c => c.Without(c => c.Id)); var contestants = _fixture.CreateMany <Contestant>(numberOfEntries); DbContext.Contestants.AddRange(contestants); await DbContext.SaveChangesAsync(); var competitionRepository = new CompetitionRepository(DbContext); // Act var actual = await competitionRepository.MaxPageCount(); // Assert actual.Should().Be(expectedMaxPage); }
public void Dispose() { DbContext.Dispose(); DbContext = new AcmeCorpContext(_options); }
public TestFixture() { _options = new DbContextOptionsBuilder <AcmeCorpContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; DbContext = new AcmeCorpContext(_options); }
public GenerateContestantsHandler(AcmeCorpContext context, IProductService productService) { _context = context; _productService = productService; }