public void DistributionList_MembershipEdit() { //Add a user to it. UserBase oUser; WebCallResult res = UserBase.GetUser(out oUser, _connectionServer, "", "operator"); Assert.IsTrue(res.Success, "Getting operator for new distribution list failed: " + res.ToString()); res = _tempList.AddMemberUser(oUser.ObjectId); Assert.IsTrue(res.Success, "Adding operator user to new distribution list failed: " + res.ToString()); //Add a list to it DistributionList oNewList; res = DistributionList.GetDistributionList(out oNewList, _connectionServer, "", "allvoicemailusers"); Assert.IsTrue(res.Success, "Get AllVoiceMail users list failed: " + res.ToString()); res = _tempList.AddMemberList(oNewList.ObjectId); Assert.IsTrue(res.Success, "Adding AllUsersDistribution list as a member to the new list failed: " + res.ToString()); //get count - make sure it equals 2 List <DistributionListMember> oMemberList; res = _tempList.GetMembersList(out oMemberList); Assert.IsTrue(res.Success, "Getting membership list from new distribution list failed: " + res.ToString()); Assert.AreEqual(oMemberList.Count, 2, "Membership list fetch from new distribution list did not return 2 members as it should."); //remove both members from it - also exercise the DistributionListMember toString and DumpAll here foreach (DistributionListMember oMember in oMemberList) { Console.WriteLine(oMember.ToString()); Console.WriteLine(oMember.DumpAllProps()); res = _tempList.RemoveMember(oMember.ObjectId); Assert.IsTrue(res.Success, "Removal of member from new distribution list failed for:" + oMember); } //get count - make sure it equals 0 res = _tempList.GetMembersList(out oMemberList); Assert.IsTrue(res.Success, "Failed getting members list:" + res); Assert.AreEqual(oMemberList.Count, 0, "After removal of members from the new distribution list the count of members reports more than 0."); }