コード例 #1
0
        public async Task UpdateLeilaoComSucesso()
        {
            //Arranje
            var faker             = new Faker("pt_BR");
            var leilaoRepository  = new LeilaoRepository(this.Context);
            var usuarioRepository = new UsuarioRepository(this.Context);
            var usuarioId         = await usuarioRepository.InsertAsync(new Usuario(faker.Name.FullName(), faker.Internet.Email()));

            var leilaoId = await leilaoRepository.InsertAsync(
                new Leilao(usuarioId, "Teste leilão GetLeilaoIdComSucesso", null, DateTime.UtcNow, DateTime.UtcNow.AddDays(50), 250.50)
                );


            Leilao leilao = await leilaoRepository.GetByIdAsync(leilaoId);

            string leilaoTituloUpdate = "Titulo leilão Update";

            leilao.Update(new LeilaoUpdate(leilaoId, usuarioId, leilaoTituloUpdate, null, null, null, null));
            //Act
            await leilaoRepository.UpdateAsync(leilao);

            //Assert
            Leilao leilaoUpdate = await leilaoRepository.GetByIdAsync(leilaoId);

            Assert.Equal(leilaoTituloUpdate, leilaoUpdate.Titulo);
        }