public void PrivateListTopLevelUpdate()
        {
            PrivateList oTestList;

            try
            {
                oTestList = new PrivateList(_connectionServer, _tempUser.ObjectId, "", 1);
                Console.WriteLine(oTestList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create new private list class instance with list Id of 1" + ex);
            }

            try
            {
                oTestList = new PrivateList(_connectionServer, _tempUser.ObjectId, _tempPrivateList.ObjectId);
                Console.WriteLine(oTestList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create new private list class instance with valid ObjectId" + ex);
            }

            WebCallResult res = _tempPrivateList.Update();

            Assert.IsFalse(res.Success, "Calling Update with no pending changes did not result in an error");

            Console.WriteLine(_tempPrivateList.ToString());
            Console.WriteLine(_tempPrivateList.DumpAllProps());

            res = _tempPrivateList.AddMemberUser(_tempUser.ObjectId);
            Assert.IsTrue(res.Success, "Failed to add user to private list:" + res);

            List <DistributionList> oPublicLists;

            res = DistributionList.GetDistributionLists(_connectionServer, out oPublicLists, 1, 20);
            Assert.IsTrue(res.Success, "Failed to fetch public lists:" + res);
            Assert.IsTrue(oPublicLists.Count > 0, "No public lists found");

            res = _tempPrivateList.AddMemberPublicList(oPublicLists[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to add public list as private list member:" + res);

            List <PrivateListMember> oMembers;

            res = _tempPrivateList.GetMembersList(out oMembers);
            Assert.IsTrue(res.Success, "Failed to fetch members of private list:" + res);
            Assert.IsTrue(oMembers.Count == 2, "Two members not returned from new private list");

            res = _tempPrivateList.RemoveMember(oMembers[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed removing private list member:" + res);

            _tempPrivateList.DisplayName = "New display name";
            res = _tempPrivateList.Update();
            Assert.IsTrue(res.Success, "Failed updating private list:" + res);

            res = _tempPrivateList.RefetchPrivateListData();
            Assert.IsTrue(res.Success, "Failed to refetch private list data:" + res);
        }
Пример #2
0
        public void PrivateList_Test()
        {
            PrivateList oList;
            var         res = PrivateList.AddPrivateList(_connectionServer, _tempUser.ObjectId, "Test list 1", 1, out oList);

            Assert.IsTrue(res.Success, "Failed to create private list for user:"******"Failed to add member to private list");

            _errorString = "";
            List <PrivateList> oPrivateLists;

            res = PrivateList.GetPrivateLists(_connectionServer, _tempUser.ObjectId, out oPrivateLists, 1, 2);
            Assert.IsTrue(res.Success & oPrivateLists.Count > 0, "Failed to fetch private lists:" + res);
            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);

            //private list member
            foreach (var oPrivateList in oPrivateLists)
            {
                List <PrivateListMember> oPrivateListMembers;
                res = PrivateList.GetMembersList(_connectionServer, oPrivateList.ObjectId, _tempUser.ObjectId,
                                                 out oPrivateListMembers);
                Assert.IsTrue(res.Success & oPrivateLists.Count > 0, "Failed to fetch private list members:" + res);
                if (oPrivateListMembers.Count > 0)
                {
                    break;
                }
            }

            Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString);
        }