public void CheckPostForMessages() { var post = GetPostWithMessages(); var newpost = UserPostTests.GetDummyPost(); newpost.Id = 2; foreach (var m in post.Messages) { m.Body = ""; Assert.IsFalse(MessageAction.CanCreateMessage(m, m.CreatedBy, newpost)); } }
private Post GetPostWithMessages() { Post post = UserPostTests.GetDummyPost(); for (int i = 0; i < messageCount; i++) { var message = new Message { Id = i, Body = "testing", CreatedBy = new ApplicationUser { Id = i + "" }, SendTo = post.Author, }; post.Messages.Add(message); } return(post); }