public async Task VisitorService_GetAll_Returns_Visitors() { // Arrange var optionsBuilder = new DbContextOptionsBuilder <AntipaDbContext>().UseInMemoryDatabase("antipadb"); var existingVisitor = new Visitor { Age = 1 }; using (var dbContext = new AntipaDbContext(optionsBuilder.Options)) { // Act var sut = new VisitorService(dbContext); await sut.CreateVisitor(existingVisitor); // Assert Assert.NotEmpty(await sut.GetAll()); } }
public VisitsService(AntipaDbContext dbContext) { _dbContext = dbContext; }