Esempio n. 1
0
        public void RemoverComentario_ComentarioExistente_DeveRemoverComSucesso()
        {
            //Arrange
            Postagem postagem    = CriarPostagemValida();
            string   comentario1 = _faker.Lorem.Word();
            string   comentario2 = _faker.Lorem.Word();
            Guid     usuarioId   = Guid.NewGuid();

            postagem.Comentar(new Comentario(usuarioId, postagem.Id, comentario1));
            postagem.Comentar(new Comentario(usuarioId, postagem.Id, comentario2));

            Comentario comentario = postagem.Comentarios.FirstOrDefault();

            //Act
            postagem.RemoverComentario(comentario.Id, usuarioId);

            //Assert
            postagem.TotalDeComentarios().Should().Be(1);
            postagem.Comentarios.Should().NotContain(c => c.Id == comentario.Id);
        }
Esempio n. 2
0
        public void Comentar_ComentarioValido_ComentarioAdicionadoComSucesso()
        {
            //Arrange
            Postagem postagem    = CriarPostagemValida();
            string   comentario  = _faker.Lorem.Word();
            string   comentario2 = _faker.Lorem.Word();
            Guid     usuarioId   = Guid.NewGuid();

            //Act
            postagem.Comentar(new Comentario(usuarioId, postagem.Id, comentario));
            postagem.Comentar(new Comentario(usuarioId, postagem.Id, comentario2));

            //Assert
            postagem.TotalDeComentarios().Should().Be(2);

            postagem.Comentarios.ToList()[0].Corpo.Conteudo.Should().Be(comentario);
            postagem.Comentarios.ToList()[0].SubComentarios.Should().HaveCount(0);

            postagem.Comentarios.ToList()[1].Corpo.Conteudo.Should().Be(comentario2);
            postagem.Comentarios.ToList()[1].SubComentarios.Should().HaveCount(0);
        }