public void GetRoutingRules_NullConnectionServer_Failure() { List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(null, out oRules); Assert.IsFalse(res.Success, "Calling GetRoutingRules with null ConnectionServerRest should fail"); }
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); }
public void GetRoutingRules_ValidQuery_NoResults() { List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_connectionServer, out oRules, 1, 20, "query=(ObjectId is blah)"); Assert.IsTrue(res.Success, "Calling GetRoutingRules with valid query should not fail:" + res); Assert.IsTrue(oRules.Count == 0, "Getting rules with valid query for no results should return 0 rules, returned:" + oRules.Count); }
public void GetRoutingRules_InvalidQuery_Failure() { List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_connectionServer, out oRules, 1, 20, "query=(blah is blah)"); Assert.IsFalse(res.Success, "Calling GetRoutingRules with invalid query should fail:"); Assert.IsTrue(oRules.Count == 0, "Getting rules with invalid query should return 0 rules, returned:" + oRules.Count); }
public void RoutingRule_Test() { _errorString = ""; List <RoutingRule> oRoutingRules; var res = RoutingRule.GetRoutingRules(_connectionServer, out oRoutingRules, 1, 2); Assert.IsTrue(res.Success, "Failed to fetch routingrule:" + res); Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString); }
public void GetRoutingRules_EmptyResult_Failure() { Reset(); _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 <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_mockServer, out oRules, 1, 5, ""); Assert.IsFalse(res.Success, "Calling GetRoutingRules with EmptyResultText did not fail"); }
public void GetRoutingRules_ZeroCount_Success() { Reset(); _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "junk text", TotalObjectCount = 0 }); List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_mockServer, out oRules, 1, 5, null); Assert.IsTrue(res.Success, "Calling GetRoutingRules with ZeroCount failed:" + res); }
public void GetRoutingRules_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 }); List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_mockServer, out oRules, 1, 5, null); Assert.IsFalse(res.Success, "Calling GetRoutingRules with ErrorResponse did not fail"); }
public void GetRoutingRules_GarbageResponse_Failure() { Reset(); _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, TotalObjectCount = 1, ResponseText = "garbage result that will not be parsed out as call handler JSON data" }); List <RoutingRule> oRules; var res = RoutingRule.GetRoutingRules(_mockServer, out oRules, 1, 5, null); Assert.IsFalse(res.Success, "Calling GetRoutingRules with garbage results should fail"); Assert.IsTrue(oRules.Count == 0, "Invalid result text should produce an empty list"); }