public void SendMessage_SecondNullUser_ThrowsException() { IServiceUser userNull = null; var user = new StubIServiceUser(); service.AddUser(user); service.SendMessage(user, userNull, subject, content); }
public void GetUser_UserDoesNotExists_ReturnsNull() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); } }; Assert.AreEqual(service.GetUser(user.NicknameGet()), null); }
public void SendMessage_MessageSubjectAndContentEmpty_ThrowsException() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); } }; service.AddUser(user); service.SendMessage(user, user, String.Empty, String.Empty); }
public void SendMessage_MessageEmptyWithNicknames_ThrowsException() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); } }; service.AddUser(user); service.SendMessage(user.NicknameGet(), user.NicknameGet(), String.Empty, String.Empty); }
public void UserExists_UserNotInList_ReturnsFalse() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); } }; Assert.IsFalse(service.UserExists(user)); }
public void SendMessage_SecondEmptyNickname_ThrowsException() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); } }; service.AddUser(user); service.SendMessage(user.NicknameGet(), String.Empty, subject, content); }
public void LogIn_UserDoesNotExist_ReturnsNull() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); } }; Assert.AreEqual(service.LogIn(properNickname, properPassword), null); }
public void GetUser_UserExists_ReturnsUser() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); } }; service.AddUser(user); Assert.AreEqual(service.GetUser(user.NicknameGet()), user); }
public void DeleteUser_SimilarUserObject_ReturnsFalse() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); }, }; service.AddUser(properNickname, properPassword); Assert.IsFalse(service.DeleteUser(user)); }
public void AddUser_ProperUserObject_AddsUserToUsersList() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); } }; service.AddUser(user); CollectionAssert.Contains(service.Users, user); }
public void LogIn_UserExists_ReturnsUser() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); } }; service.AddUser(user); Assert.AreEqual(service.LogIn(properNickname, properPassword), user); }
public void DeleteUser_ExistingUserObject_ReturnsTrue() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); }, }; service.AddUser(user); service.DeleteUser(user); CollectionAssert.DoesNotContain(service.Users, user); }
public void SendMessage_UserDoesNotExists_AddsMessageToMessagesList() { var user1 = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); }, SentGet = () => { return(new List <IServiceMessage>()); }, InboxGet = () => { return(new List <IServiceMessage>()); } }; var user = new StubIServiceUser(); service.AddUser(user1); service.SendMessage(user1, user, subject, content); }
public void AddUser_MultipleUniqueUsers_AddsMultipleUsersToList() { int numTimes = 5; for (int i = 0; i < numTimes; i++) { string concat = properNickname + i; var user = new StubIServiceUser() { NicknameGet = () => { return(concat); } }; service.AddUser(user); } Assert.AreEqual(service.Users.Count, numTimes); }
public void AddUser_UserIsAlreadyInList_ThrowsException() { var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); } }; int numTimes = 5; for (int i = 0; i < numTimes; i++) { service.AddUser(user); } Assert.AreEqual(service.Users.Count, 1); }
public void SendMessage_ExistingNicknames_AddsMessageToInbox() { var user1 = new StubIServiceUser() { NicknameGet = () => { return(properNickname); }, PasswordGet = () => { return(properPassword); }, SentGet = () => { return(new List <IServiceMessage>()); }, InboxGet = () => { return(new List <IServiceMessage>()); } }; var user = new StubIServiceUser() { NicknameGet = () => { return(properNickname1); }, PasswordGet = () => { return(properPassword); }, SentGet = () => { return(new List <IServiceMessage>()); }, InboxGet = () => { return(new List <IServiceMessage>()); } }; service.AddUser(user1); service.AddUser(user); service.SendMessage(user1.NicknameGet(), user.NicknameGet(), subject, content); StringAssert.Equals(service.Messages[0].Subject, subject); }