Esempio n. 1
0
        public void GetPrivateLists_NullConnectionServer_Failure()
        {
            List <PrivateList> oLists;
            WebCallResult      res = PrivateList.GetPrivateLists(null, "blah", out oLists);

            Assert.IsFalse(res.Success, "Fetching private lists with null ConnectionServerRest did not fail");
        }
Esempio n. 2
0
        public void UpdatePrivateList_EmptyPropertyList_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();
            var res = PrivateList.UpdatePrivateList(_mockServer, "Object", oProps, "ownerid");

            Assert.IsFalse(res.Success, "Updating private list via static method did not fail with empty property list");
        }
Esempio n. 3
0
        public void GetPrivateLists_EmptyOwnerObjectId_Failure()
        {
            List <PrivateList> oLists;
            WebCallResult      res = PrivateList.GetPrivateLists(_mockServer, "", out oLists);

            Assert.IsFalse(res.Success, "Fetching private lists with empty owner objectId did not fail");
        }
Esempio n. 4
0
        private void RemoveFromList(PrivateList list, Type type, IBehaviourManager manager)
        {
            var listType     = list.List.GetType();
            var removeMethod = listType.GetMethod("Remove", new Type[] { type });

            removeMethod.Invoke(list.List, new object[] { manager });
        }
        public void GetPrivateList_InvalidListId_Failure()
        {
            PrivateList oNewPrivateList;
            var         res = PrivateList.GetPrivateList(out oNewPrivateList, _connectionServer, _tempUser.ObjectId, "", 999);

            Assert.IsFalse(res.Success, "Fetching private list with invalid listId should fail");
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        private void AddToList(PrivateList list, Type type, IBehaviourManager manager)
        {
            var listType  = list.List.GetType();
            var addMethod = listType.GetMethod("Add", new Type[] { type });

            addMethod.Invoke(list.List, new object[] { manager });
        }
Esempio n. 8
0
        public void GetPrivateList_EmptyUserObjectId_Failure()
        {
            PrivateList oNewPrivateList;
            var         res = PrivateList.GetPrivateList(out oNewPrivateList, _mockServer, "");

            Assert.IsFalse(res.Success, "Fetching private list with empty owner objectId not fail");
        }
        public void GetPrivateLists_Success()
        {
            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_connectionServer, _tempUser.ObjectId, out oLists);

            Assert.IsTrue(res.Success, "Failed fetching private lists for user:" + res);
        }
        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);
        }
        public void GetPrivateList_InvalidOwnerObjectId_Failure()
        {
            PrivateList oNewPrivateList;

            var res = PrivateList.GetPrivateList(out oNewPrivateList, _connectionServer, "ownerobjectid");

            Assert.IsFalse(res.Success, "Fetching private list with invalid user objectId did not fail");
        }
Esempio n. 12
0
        public void GetPrivateList_NullConnectionServer_Failure()
        {
            PrivateList oNewPrivateList;

            var res = PrivateList.GetPrivateList(out oNewPrivateList, null, "OwnerObjectId");

            Assert.IsFalse(res.Success, "Fetching private list with null ConnectionServerRest did not fail");
        }
        public void GetPrivateListVoiceName_InvalidObjectId_Failure()
        {
            var res = PrivateList.GetPrivateListVoiceName(_connectionServer, "userobjectid", "c:\\temp.wav", "ObjectId",
                                                          "wavname");

            Assert.IsFalse(res.Success,
                           "Getting private list voice name via static method did not fail with invalid objectId");
        }
        public void UpdatePrivateList_InvalidObjectIdAndOwnerObjectId_Failure()
        {
            ConnectionPropertyList oProps = new ConnectionPropertyList();

            oProps.Add("blah", "blah");
            var res = PrivateList.UpdatePrivateList(_connectionServer, "Object", oProps, "ownerId");

            Assert.IsFalse(res.Success, "Updating private list via static method did not fail with invalid owner and objectIds ");
        }
Esempio n. 15
0
 private static void PrivateLoadList()
 {
     PrivateList.Add("Rick");
     PrivateList.Add("Morty");
     PrivateList.Add("Naruto");
     PrivateList.Add("Sasuke");
     PrivateList.Add("Jet");
     PrivateList.Add("Major");
     PrivateList.Add("Afro Samuarai");
     PrivateList.Add("Ally Ford");
     PrivateList.Add("Alex Boone");
     PrivateList.Add("Caylee Cook");
 }
Esempio n. 16
0
        public void GetPrivateLists_GarbageResults_Success()
        {
            //garbage response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = "garbage result"
            });
            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "InvalidResultText", out oLists);

            Assert.IsTrue(res.Success, "Calling GetPrivateLists with InvalidResultText should not fail:" + res);
            Assert.IsTrue(oLists.Count == 0, "Invalid result text should result in empty list returned");
        }
Esempio n. 17
0
        public void GetPrivateLists_ErrorResponse_Failure()
        {
            //error response
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
                StatusCode   = 404
            });
            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "ErrorResponse", out oLists);

            Assert.IsFalse(res.Success, "Calling GetPrivateLists with ErrorResponse did not fail");
            Assert.IsTrue(oLists.Count == 0, "Error result should result in empty list returned");
        }
Esempio n. 18
0
        public void GetPrivateLists_EmptyResults_Failure()
        {
            //empty results
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), true)).Returns(new WebCallResult
            {
                Success      = true,
                ResponseText = ""
            });

            List <PrivateList> oLists;
            var res = PrivateList.GetPrivateLists(_mockServer, "EmptyResultText", out oLists);

            Assert.IsFalse(res.Success, "Calling GetPrivateLists with EmptyResultText did not fail");
            Assert.IsTrue(oLists.Count == 0, "Empty result text should result in empty list returned");
        }
Esempio n. 19
0
        public static void RunTest()
        {
            PrivateLoadList();
            //Console.WriteLine("Un-sorted");
            //DisplayList(PrivateList);
            //Console.WriteLine();

            //PrivateList.Sort();
            //Console.WriteLine("Sorted");
            //DisplayList(PrivateList);
            //Console.WriteLine();

            //PrivateList.Reverse();
            //Console.WriteLine("Sorted in Reverse");
            //DisplayList(PrivateList);
            //Console.WriteLine();

            /*
             * Testing
             * // Sort
             * list.Sort((a, b) => (a.ToString().CompareTo("string term")));
             *
             * or
             *
             * // Remove and Insert to 0 index
             * list.Remove("string term");
             * list.Insert(0, "string term");
             *
             * or
             *
             * list.OrderByDescending(r => r == "string term").ToList();
             */

            var preferences = new List <string> {
                "Jet", "Sasuke"
            };

            PrivateList.Sort();
            PrivateList.Sort((a, b) => (b.ToString().CompareTo("Jet")));
            Console.WriteLine("CompareTo \"Jet\" Sort");
            DisplayList(PrivateList);
            Console.WriteLine();
        }
        public new static void MyClassInitialize(TestContext testContext)
        {
            BaseIntegrationTests.MyClassInitialize(testContext);

            //create new list with GUID in the name to ensure uniqueness
            String strUserAlias = "TempUserPrivList_" + Guid.NewGuid().ToString().Replace("-", "");

            //generate a random number and tack it onto the end of some zeros so we're sure to avoid any legit numbers on the system.
            Random random       = new Random();
            int    iExtPostfix  = random.Next(100000, 999999);
            string strExtension = "000000" + iExtPostfix.ToString();

            //use a bogus extension number that's legal but non dialable to avoid conflicts
            WebCallResult res = UserBase.AddUser(_connectionServer, "voicemailusertemplate", strUserAlias, strExtension, null, out _tempUser);

            Assert.IsTrue(res.Success, "Failed creating temporary user:"******"Test Private List1", 1, out _tempPrivateList);
            Assert.IsTrue(res.Success, "Failed to create new private list for user:" + res);
        }
        public void PrivateListVoiceName()
        {
            WebCallResult res = _tempPrivateList.SetVoiceName("blah.blah");

            Assert.IsFalse(res.Success, "Voice name update with invalid file name did not fail");

            res = _tempPrivateList.SetVoiceName("Dummy.wav", true);
            Assert.IsTrue(res.Success, "Failed updating private list voice name:" + res);

            //fetch updated VoiceName string by reloading the private list
            PrivateList oPrivateList = null;

            try
            {
                oPrivateList = new PrivateList(_connectionServer, _tempPrivateList.UserObjectId, _tempPrivateList.ObjectId);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create updated private list instance:" + ex);
            }

            res = oPrivateList.GetVoiceName("DummyDownload.wav");
            Assert.IsTrue(res.Success, "Failed fetching private list voice name:" + res);
        }
Esempio n. 22
0
        public void Constructor_EmptyOwnerObjectId_Failure()
        {
            PrivateList oTest = new PrivateList(_mockServer, "", "ObjectId");

            Console.WriteLine(oTest);
        }
        public void AddPrivateList_InvalidListNumber_Failure()
        {
            var res = PrivateList.AddPrivateList(_connectionServer, _tempPrivateList.ObjectId, "display name", 200);

            Assert.IsFalse(res.Success, "Adding private list with invalid numeric id did not fail");
        }
        public void AddPrivateList_InvalidObjectId_Failure()
        {
            var res = PrivateList.AddPrivateList(_connectionServer, "objectid", "display name", 1);

            Assert.IsFalse(res.Success, "Adding private list with invalid UserObjectId did not fail");
        }
        public void Constructor_InvalidObjectId_Failure()
        {
            PrivateList oTest = new PrivateList(_connectionServer, "blah", "blah");

            Console.WriteLine(oTest);
        }
Esempio n. 26
0
        public void AddPrivateList_NullConnectionServer_Failure()
        {
            var res = PrivateList.AddPrivateList(null, "OwnerObjectId", "ObjectId", 1);

            Assert.IsFalse(res.Success, "Adding private list with null connection server did not fail");
        }
Esempio n. 27
0
        public void AddPrivateList_BlankObjectId_Failure()
        {
            var res = PrivateList.AddPrivateList(_mockServer, "OwnerObjectId", "", 1);

            Assert.IsFalse(res.Success, "Adding private list with blank display name did not fail");
        }
        public void AddMemberUser_InvalidObjectIds_Failure()
        {
            var res = PrivateList.AddMemberUser(_connectionServer, "PrivateListObjectId", "UserObjectId", "OwnerObjectId");

            Assert.IsFalse(res.Success, "Adding private list user member via static method did not fail with invalid objectIds");
        }
        public void SetPrivateListVoiceName_InvalidObjectId_Failure()
        {
            var res = PrivateList.SetPrivateListVoiceName(_connectionServer, "c:\\temp.wav", "objectid", "UserObjectId", true);

            Assert.IsFalse(res.Success, "Setting private list voice name via static method did not fail with ObjectId");
        }
        public void DeletePrivateList_InvalidUserObjectIdAndObjectId_Failure()
        {
            var res = PrivateList.DeletePrivateList(_connectionServer, "Object", "UserObjectId");

            Assert.IsFalse(res.Success, "Deleting private list via static method did not fail with invalid user and ObjectIds");
        }