public void NotifyUserJoinedTest()
 {
     var user = new User { Name = "Florian" };
     var mock = new Mock<IMessagingServiceCallback>();
     mock.Setup(x => x.NotifyUserJoined(user));
     var target = mock.Object;
     target.NotifyUserJoined(user);
     mock.Verify(x => x.NotifyUserJoined(user));
 }
Пример #2
0
 public void JoinTest()
 {
     var user = new User { Name = "Florian" };
     var mock = new Mock<Services>();
     mock.Setup(x => x.Join(user)).Returns(
         new Session { ExpiryDate = DateTime.Today.AddDays(1), User = new User { Name = "Florian" } });
     var target = mock.Object;
     var actual = target.Join(user);
     Assert.IsNotNull(actual);
 }
Пример #3
0
 /// <summary>
 /// Removes the user.
 /// </summary>
 /// <param name="u">The u.</param>
 private void RemoveUser(User u)
 {
     this.JoinedUsers.Remove(this.JoinedUsers.Single(ru => ru.Equals(u)));
     this.MessageHistoryTextBox.Text += string.Format("{0}\t{1} left the conversation\r\n", DateTime.Now, u.Name);
 }
Пример #4
0
        /// <summary>
        /// Joins the user.
        /// </summary>
        /// <param name="username">The username.</param>
        private void JoinUser(string username)
        {
            var user = new User
            {
                Name = username
            };

            this.currentSession = this.userProxy.Join(user);
        }
Пример #5
0
 /// <summary>
 /// Adds the user.
 /// </summary>
 /// <param name="u">The u.</param>
 private void AddUser(User u)
 {
     this.JoinedUsers.Add(u);
     this.MessageHistoryTextBox.Text += string.Format("{0}\t{1} joined the conversation\r\n", DateTime.Now, u.Name);
 }
Пример #6
0
        /// <summary>
        /// Notifies the user left.
        /// </summary>
        /// <param name="user">The user.</param>
        public void NotifyUserLeft(User user)
        {
            SendOrPostCallback callback = state => this.RemoveUser(user);

            this.uiSyncContext.Post(callback, user);
        }
Пример #7
0
        /// <summary>
        /// Notifies the user joined.
        /// </summary>
        /// <param name="user">The user.</param>
        public void NotifyUserJoined(User user)
        {
            SendOrPostCallback callback = state => this.AddUser(user);

            this.uiSyncContext.Post(callback, user);
        }
Пример #8
0
 /// <summary>
 /// Adds the user.
 /// </summary>
 /// <param name="u">The u.</param>
 private void AddUser(User u)
 {
     ((UserList)this.Resources["JoinedUsers"]).Add(u);
     this.MessageHistoryTextBox.Text += string.Format("{0}\t{1} joined the conversation\r\n", DateTime.Now, u.Name);
 }