Ejemplo 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);
        }