コード例 #1
0
        public void GetDcHeroesAsync_does_return_correctly(
            int maxHeroLength, Mock <IUnitOfWorkFactory> factory, Mock <IUnitOfWork> unitOfWork)
        {
            //Arrange
            var heroes   = new Fixture().CreateMany <Hero>(maxHeroLength);
            var sut      = new HeroService(factory.Object);
            var stubRepo = new StubHeroRepo(heroes);

            unitOfWork.Setup(q => q.GetRepository <Hero, int>()).Returns(stubRepo);
            factory.Setup(q => q.CreateUnitOfWork()).Returns(unitOfWork.Object);

            //Act
            var foundHeroes = sut.GetDcHeroesAsync().Result;

            //Assert
            foundHeroes.Should().BeEquivalentTo(heroes);
        }