public async Task GetById_inexistent_heroes(Guid id)
        {
            // Arrange
            using (var context = CreateDbContext("GetById_inexisting_heroes"))
            {
                context.Set <Hero>().Add(new Hero {
                    Id = id
                });
                await context.SaveChangesAsync();
            }
            Hero hero = null;

            // Act
            using (var context = CreateDbContext("GetById_inexisting_heroes"))
            {
                var repository = new HeroRepository(context);
                hero = await repository.GetById(new Guid());
            }
            // Assert
            hero.Should().BeNull();
        }
Exemplo n.º 2
0
 public Hero Get(int id)
 {
     return(HeroRepository.GetById(id));
 }