public async Task GetAll_heroes(int count)
        {
            // Arrange
            using (var context = CreateDbContext($"GetAll_with_heroes_{count}"))
            {
                for (var i = 0; i < count; i++)
                {
                    context.Set <Hero>().Add(new Hero());
                }
                await context.SaveChangesAsync();
            }
            List <Hero> heroes = null;

            // Act
            using (var context = CreateDbContext($"GetAll_with_heroes_{count}"))
            {
                var repository = new HeroRepository(context);
                heroes = await repository.GetAll().ToListAsync();
            }
            // Assert
            heroes.Should().NotBeNull();
            heroes.Count().Should().Be(count);
        }
Exemplo n.º 2
0
 public IList <Hero> Get()
 {
     return(HeroRepository.GetAll());
 }