public void CreateMessage() { DateTime datetime = DateTime.UtcNow; Message message = new Message(1, 2, datetime, "foo"); Assert.AreEqual(1u, message.Id); Assert.AreEqual(2u, message.UserId); Assert.AreEqual(datetime, message.DateTime); Assert.AreEqual("foo", message.Content); }
public Message NewMessage(ulong userid, string content) { DateTime datetime = DateTime.UtcNow; ulong id = this.NextId(); Message message = new Message(id, userid, datetime, content); this.repository.AddMessage(message); User user = this.urepository.GetUser(userid); user.AddMessage(message); foreach (ulong followerid in user.FollowerIds) { User follower = this.urepository.GetUser(followerid); follower.AddMessage(message); } return message; }
public void AddMessage(Message message) { this.messages.Add(message); }
public void RaiseWhenUserIdIsZero() { DateTime datetime = DateTime.UtcNow; Message message = new Message(1, 0, datetime, "foo"); }
public void RaiseWhenContentIsNull() { DateTime datetime = DateTime.UtcNow; Message message = new Message(1, 2, datetime, null); }