コード例 #1
0
        public void ShowsOnlyMessagesFromTheFollowedUser()
        {
            var aliceFollowedBob = new UserFollowed("Alice", "Bob");
            var bobsPost         = new MessagePosted("Bob", "A message from Bob", fakeClock.HypoteticalNow);

            wallPresenter.Handle(aliceFollowedBob);
            wallPresenter.Handle(bobsPost);

            var alicesWall = GetWallFor(userName);

            Assert.That(alicesWall[0], Is.EqualTo("Bob - A message from Bob (0 seconds ago)"));
        }
コード例 #2
0
        public void AggregatesTheirMessagesToTheSourceUsersWall()
        {
            var alicesPost       = new MessagePosted("Alice", "A message from Alice", fakeClock.HypoteticalNow);
            var aliceFollowedBob = new UserFollowed("Alice", "Bob");
            var bobsPost         = new MessagePosted("Bob", "A message from Bob", fakeClock.HypoteticalNow.AddSeconds(1));

            wallPresenter.Handle(alicesPost);
            wallPresenter.Handle(aliceFollowedBob);
            wallPresenter.Handle(bobsPost);

            var alicesWall = GetWallFor(userName);

            Assert.That(alicesWall[0], Is.EqualTo("Alice - A message from Alice (0 seconds ago)"));
            Assert.That(alicesWall[1], Is.EqualTo("Bob - A message from Bob (1 second ago)"));
        }
コード例 #3
0
        public void ShowsMessagesFromMultipleFollowedUsers()
        {
            var aliceFollowedBob     = new UserFollowed("Alice", "Bob");
            var aliceFollowedCharlie = new UserFollowed("Alice", "Charlie");

            var bobsPost    = new MessagePosted("Bob", "A message from Bob", fakeClock.HypoteticalNow);
            var charliePost = new MessagePosted("Charlie", "A message from Charlie", fakeClock.HypoteticalNow);

            wallPresenter.Handle(aliceFollowedBob);
            wallPresenter.Handle(aliceFollowedCharlie);
            wallPresenter.Handle(bobsPost);
            wallPresenter.Handle(charliePost);

            var alicesWall = GetWallFor(userName);

            Assert.That(alicesWall[0], Is.EqualTo("Bob - A message from Bob (0 seconds ago)"));
            Assert.That(alicesWall[1], Is.EqualTo("Charlie - A message from Charlie (0 seconds ago)"));
        }
コード例 #4
0
 internal void SetLastMessageId(long ChatId, int MessageId)
 {
     if (LastMessageIds.ContainsKey(ChatId))
     {
         LastMessageIds[ChatId] = MessageId;
     }
     else
     {
         LastMessageIds.Add(ChatId, MessageId);
     }
     try
     {
         if (Machines.ContainsKey(Convert.ToInt32(ChatId)))
         {
             Machines[Convert.ToInt32(ChatId)].SetLastMessageId(MessageId);
         }
     }
     catch
     { }
     MessagePosted?.Invoke(ChatId, MessageId);
 }
コード例 #5
0
ファイル: WebViewBridge.cs プロジェクト: gave92/React-WBI
 /// <summary>
 /// Posts a message.
 /// </summary>
 /// <param name="message">The message.</param>
 public void PostMessage(string message)
 {
     MessagePosted?.Invoke(this, new MessagePostedEventArgs(_tag, message));
 }
コード例 #6
0
 protected virtual void OnMessagePosted(NntpMessage e)
 {
     MessagePosted?.Invoke(this, e);
 }
コード例 #7
0
        public void Handle(PostMessage message)
        {
            var messagePosted = new MessagePosted(message.UserName, message.Message, DateTime.Now);

            bus.Publish(messagePosted);
        }