예제 #1
0
        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());
            }
        }
예제 #2
0
 public VisitsService(AntipaDbContext dbContext)
 {
     _dbContext = dbContext;
 }