Exemplo n.º 1
0
        public void CreateComment()
        {
            var sender   = userWithEmail;
            var receiver = userWithoutEmail;
            var result   = data.CreateComment(receiver.Id, "Hello world");

            Assert.IsNotNull(result, "result");
            Assert.AreEqual("Hello world", result.Message, "Message");

            var comment = repository.List <Comment>().FirstOrDefault();

            Assert.IsNotNull(comment, "Comment was saved");
            Assert.AreEqual("Hello world", comment.Message, "Message");
            Assert.AreEqual(sender.Id, comment.Author.Id, "Sender Id");
            Assert.AreEqual(receiver.Id, comment.Entry.Id, "Receiver Id");

            var notificationMsg = string.Format("{0} posted a comment on your profile.\n\n{1}", sender.Name, comment.Message);
            var notification    = repository.List <UserMessage>().FirstOrDefault();

            Assert.IsNotNull(notification, "Notification was saved");
            Assert.AreEqual(notificationMsg, notification.Message, "Notification message");
            Assert.AreEqual(receiver.Id, notification.Receiver.Id, "Receiver Id");
        }
Exemplo n.º 2
0
 public CommentForApiContract PostNewComment(int id, CommentForApiContract contract) => queries.CreateComment(id, contract.Message);