Exemplo n.º 1
0
        public void FetchTests()
        {
            List <RoutingRule> oRules;
            var res = RoutingRule.GetRoutingRules(_connectionServer, out oRules, 1, 10, null);

            Assert.IsTrue(res.Success, "Fetching routing rules failed:" + res);
            Assert.IsTrue(oRules.Count > 0, "No rules returned in fetch:" + res);

            RoutingRule oRule = oRules[0];

            Console.WriteLine(oRule.ToString());
            Console.WriteLine(oRule.DumpAllProps("--->"));

            RoutingRule oTest;

            res = RoutingRule.GetRoutingRule(out oTest, _connectionServer, oRule.ObjectId);
            Assert.IsTrue(res.Success, "Failed to create routing rule with valid ObjectId:" + res);
            Assert.IsTrue(oTest.ObjectId.Equals(oRule.ObjectId), "Fetched routing rule does not match objectId");

            res = RoutingRule.GetRoutingRule(out oTest, _connectionServer, "", oRule.DisplayName);
            Assert.IsTrue(res.Success, "Failed to create routing rule with valid display name:" + res);
            Assert.IsTrue(oTest.ObjectId.Equals(oRule.ObjectId), "Fetched routing rule does not match objectId");

            res = oTest.RefetchRoutingRuleData();
            Assert.IsTrue(res.Success, "Failed to refetch routing rule data");

            res = RoutingRule.GetRoutingRules(_connectionServer, out oRules, 1, 10, "query=(ObjectId is Bogus)");
            Assert.IsTrue(res.Success, "fetching rules with invalid query should not fail:" + res);
            Assert.IsTrue(oRules.Count == 0, "Invalid query string should return an empty rule list:" + oRules.Count);
        }
Exemplo n.º 2
0
        public void GetRoutingRule_InvalidDisplayName_Failure()
        {
            RoutingRule oRule;
            var         res = RoutingRule.GetRoutingRule(out oRule, _connectionServer, "", "bogus");

            Assert.IsFalse(res.Success, "Calling GetRoutingRule with invalid dispaly name should fail");
        }
Exemplo n.º 3
0
        public void GetRoutingRule_InvalidObjectId_Failure()
        {
            RoutingRule oRule;
            var         res = RoutingRule.GetRoutingRule(out oRule, _connectionServer, "objectId");

            Assert.IsFalse(res.Success, "Calling GetRoutingRule with invalid objectId should fail");
        }
Exemplo n.º 4
0
        public void GetRoutingRule_EmptyObjectIdAndDisplayName_Failure()
        {
            RoutingRule oRule;
            var         res = RoutingRule.GetRoutingRule(out oRule, _mockServer, "", "");

            Assert.IsFalse(res.Success, "Calling GetRoutingRule with empty objectId and display name should fail");
        }
Exemplo n.º 5
0
        public void GetRoutingRule_NullConnectionServer_Failure()
        {
            RoutingRule oRule;
            var         res = RoutingRule.GetRoutingRule(out oRule, null, "objectId", "displayname");

            Assert.IsFalse(res.Success, "Calling GetRoutingRule with null ConnectionServerRest should fail");
        }
Exemplo n.º 6
0
        public void GetRoutingRule_ErrorResponse_Failure()
        {
            Reset();
            _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
            });

            RoutingRule oRule;
            var         res = RoutingRule.GetRoutingRule(out oRule, _mockServer, "", "Display Name");

            Assert.IsFalse(res.Success, "Calling GetRoutingRule with ErrorResponse did not fail");
        }