Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public void AddMessage(Message message)
 {
     this.messages.Add(message);
 }
Esempio n. 4
0
 public void RaiseWhenUserIdIsZero()
 {
     DateTime datetime = DateTime.UtcNow;
     Message message = new Message(1, 0, datetime, "foo");
 }
Esempio n. 5
0
 public void RaiseWhenContentIsNull()
 {
     DateTime datetime = DateTime.UtcNow;
     Message message = new Message(1, 2, datetime, null);
 }