Esempio n. 1
0
        public async Task GetHallIdWithValidId()
        {
            ApplicationDbContext dbContext = new ApplicationDbContext(new DbContextOptionsBuilder <ApplicationDbContext>()
                                                                      .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options);
            var service = new GalleryService(new EfDeletableEntityRepository <Pic>(dbContext));
            await service.AddAsync(
                "http://www.test.com",
                "1");

            var pic = await dbContext.Pics.FirstOrDefaultAsync();

            string hallId = service.GetHallId(pic.Id);

            Assert.Equal("1", hallId);
            dbContext.Database.EnsureDeleted();
        }