コード例 #1
0
        public async Task Validar_Metodo_GetById_Com_Dados()
        {
            //Arrange
            var actor = GenerateActorFaker.CreateActor();

            this.subActorRepository
            .GetActorByIdAsync(Id)
            .Returns(actor);

            //Act
            var result = await this.ActorAppServices
                         .GetByIdAsync(Id)
                         .ConfigureAwait(false);

            //Assert
            result
            .Should()
            .BeOfType <Actor>();

            result.Id.Should().NotBe(0);
            result.Salary.Should().Be(actor.Salary);
            result.Sex.Should().Be(actor.Sex);
            result.Ranking.Should().Be(actor.Ranking);

            await this.subActorRepository
            .Received(1)
            .GetActorByIdAsync(Arg.Any <int>())
            .ConfigureAwait(false);
        }
コード例 #2
0
        public void Validar_Metodo_Get_Com_Ou_Sem_Dados(int qtd)
        {
            var listHero = GenerateActorFaker.CreateListHero(qtd);

            this.subActorRepository
            .GetActor()
            .Returns(listHero);

            //Act
            var result = this.ActorAppServices.Get();

            //Assert
            result
            .Should()
            .BeOfType <List <Actor> >();

            result
            .Should()
            .HaveCount(qtd);

            this.subActorRepository
            .Received(1)
            .GetActor();
        }