public void ChekifUsersAreFriend_ShouldReturnTrue() { //Arrange bool fr = false; //Act using (var db = new DatabaseContext()) { MessengerServices msService = new MessengerServices(db); msService.AddContactFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); fr = msService.IsFriend(testAuthUserId, testContactUserId); } //Assert Assert.True(fr); }
public void GetAllFriendRelationship_ShouldReturnListOfFriend() { //Arrange List <FriendRelationship> friends = new List <FriendRelationship>(); //Act using (var db = new DatabaseContext()) { MessengerServices msService = new MessengerServices(db); msService.AddContactFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); friends = msService.GetAllFriendRelationship(testAuthUserId).ToList(); } //Assert Assert.NotEmpty(friends); }
public void AddContactToFriendList_ShouldReturnFriendRelationship() { //Arrange FriendRelationship fr = null; //Act using (var db = new DatabaseContext()) { MessengerServices msService = new MessengerServices(db); if (msService.IsFriend(testAuthUserId, testContactUserId) == true) { msService.RemoveUserFromFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); } fr = msService.AddContactFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); } //Assert Assert.NotNull(fr); }
public void RemoveContactFromFriendList_FindDeletedFriendShouldReturnNull() { //Arrange FriendRelationship DeletedFriend = null; //Act using (var db = new DatabaseContext()) { MessengerServices msService = new MessengerServices(db); if (msService.IsFriend(testAuthUserId, testContactUserId) == false) { msService.AddContactFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); } DeletedFriend = msService.RemoveUserFromFriendList(testAuthUserId, testContactUserId); db.SaveChanges(); } //Assert Assert.NotNull(DeletedFriend); }