예제 #1
0
        public void GetClassOfService_EmptyObjectIdAndName_Failure()
        {
            ClassOfService oCos;
            var            res = ClassOfService.GetClassOfService(out oCos, _mockServer);

            Assert.IsFalse(res.Success, "Static call to GetClassOfService did not fail with: empty objectId and Name");
        }
예제 #2
0
        public void GetClassOfService_NullConnectionServer_Failure()
        {
            ClassOfService oCos;
            var            res = ClassOfService.GetClassOfService(out oCos, null, "bogus", "bogus");

            Assert.IsFalse(res.Success, "Static call to GetClassOfService did not fail with: null ConnectionServer");
        }
예제 #3
0
        public void StaticMethodFailures_GetClassOfService()
        {
            //GetClassOfService
            ClassOfService oCos;
            var            res = ClassOfService.GetClassOfService(out oCos, _connectionServer, "bogus", "bogus");

            Assert.IsFalse(res.Success, "Static call to GetClassOfService did not fail with: invalid ObjectId");
        }
예제 #4
0
        public void OutcallRestrictionTable_FetchTest()
        {
            ClassOfService oTempCos;
            var            res = ClassOfService.GetClassOfService(out oTempCos, _connectionServer, _tempCos.ObjectId);

            Assert.IsTrue(res.Success, "Failed to create instance of Cos from valie ObjectId:" + res);

            oTempCos.OutcallRestrictionObjectId = "Bogus";
            var oTable = oTempCos.OutcallRestrictionTable();

            Assert.IsNull(oTable, "Forcing invalid restriction table fetch should return null restriction table");
        }
예제 #5
0
        public void GetClassOfService_ErrorResponse_Failure()
        {
            _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(),
                                                        It.IsAny <string>(), It.IsAny <bool>())).Returns(new WebCallResult
            {
                Success      = false,
                ResponseText = "error text",
            });

            ClassOfService oCos;
            var            res = ClassOfService.GetClassOfService(out oCos, _mockServer, "ObjectId");

            Assert.IsFalse(res.Success, "Calling GetClassOfService with ErrorResponse did not fail");
        }
예제 #6
0
        public void Test_CosFetchTests()
        {
            List <ClassOfService> oCoses;
            WebCallResult         res = ClassOfService.GetClassesOfService(_connectionServer, out oCoses);

            Assert.IsTrue(res.Success, "Failed to fetch COSes:" + res);
            Assert.IsNotNull(oCoses, "Empty list returned for classes of service on fetch");
            Assert.IsTrue(oCoses.Count > 0, "no classes of service returned on fetch");

            ClassOfService oCos;

            res = ClassOfService.GetClassOfService(out oCos, _connectionServer, oCoses[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to fetch full COS from ObjectId:" + res);

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

            Assert.IsFalse(string.IsNullOrEmpty(oCos.FaxRestrictionTable().ObjectId), "No fax restriction table found for COS");
            oCos.FaxRestrictionTable(true);

            Assert.IsFalse(string.IsNullOrEmpty(oCos.OutcallRestrictionTable().ObjectId), "No outcall restriction table found for COS");
            oCos.OutcallRestrictionTable(true);

            Assert.IsFalse(string.IsNullOrEmpty(oCos.TransferRestrictionTable().ObjectId), "No transfer restriction table found for COS");
            oCos.TransferRestrictionTable(true);

            res = oCos.RefetchClassOfServiceData();
            Assert.IsTrue(res.Success, "Failed to refetch COS data:" + res);

            ClassOfService oCos2;

            res = ClassOfService.GetClassOfService(out oCos2, _connectionServer, "", oCos.DisplayName);
            Assert.IsTrue(res.Success, "Faled to fetch COS by display name");

            res = ClassOfService.GetClassesOfService(_connectionServer, out oCoses, 1, 2, "query=(ObjectId is bogus)");
            Assert.IsTrue(res.Success, "fetching COSes with invalid query should not fail:" + res);
            Assert.IsTrue(oCoses.Count == 0, "Invalid query string should return an empty COS list:" + oCoses.Count);
        }