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)); }
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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }