public void UpdateTests() { var res = _tempRule.Update(); Assert.IsFalse(res.Success, "Updating rule without any pending changes should fail"); _tempRule.LanguageCode = 1033; _tempRule.CallType = RoutingRuleCallType.Both; _tempRule.DisplayName = "UpdatedName" + Guid.NewGuid().ToString(); _tempRule.RouteAction = RoutingRuleActionType.Hangup; _tempRule.State = RoutingRuleState.Inactive; _tempRule.Type = RoutingRuleType.System; _tempRule.Undeletable = false; _tempRule.UseCallLanguage = true; res = _tempRule.Update(); Assert.IsTrue(res.Success, "Failed to update routing rule:" + res); res = _tempRule.AddRoutingRuleCondition(RoutingRuleConditionOperator.Equals, RoutingRuleConditionParameter.CallingNumber, "1234"); Assert.IsTrue(res.Success, "Failed to add a routing rule condition to rule:" + res); List <RoutingRuleCondition> oConditions; res = RoutingRuleCondition.GetRoutingRuleConditions(_connectionServer, _tempRule.ObjectId, out oConditions); Assert.IsTrue(res.Success, "Failed fetching routing rule conditions:" + res); Assert.IsTrue(oConditions.Count == 1, "1 Condition should be returned, instead count=" + oConditions.Count); RoutingRuleCondition oCondition = oConditions[0]; Console.WriteLine(oCondition.ToString()); Console.WriteLine(oCondition.DumpAllProps("-->")); //fetch by objectid RoutingRuleCondition oTestCondition; res = RoutingRuleCondition.GetRoutingRuleCondition(out oTestCondition, _connectionServer, oCondition.RoutingRuleObjectId, oCondition.ObjectId); Assert.IsTrue(res.Success, "Failed to fetch routing rule condition using valid ObjectId:" + res); Assert.IsTrue(oTestCondition.ObjectId == oCondition.ObjectId, "Fetched condition does not match ObjectId of existin condition"); res = oTestCondition.RefetchRoutingRuleConditionData(); Assert.IsTrue(res.Success, "Failed to refetch the routing rule condition items:" + res); res = oCondition.Delete(); Assert.IsTrue(res.Success, "Failed to delete condition:" + res); res = RoutingRuleCondition.AddRoutingRuleCondition(_connectionServer, _tempRule.ObjectId, RoutingRuleConditionOperator.GreaterThan, RoutingRuleConditionParameter.DialedNumber, "1234", out oTestCondition); Assert.IsTrue(res.Success, "Failed to create new routing rule condition:" + res); res = oTestCondition.Delete(); Assert.IsTrue(res.Success, "Failed to delete condition:" + res); }
public void Update_NoPendingChanges_Failure() { RoutingRule oRule = new RoutingRule(_mockServer, ""); oRule.ClearPendingChanges(); var res = oRule.Update(); Assert.IsFalse(res.Success, "Calling Update with no pending changes should fail"); }
public void Update_ErrorResponse_Failure() { Reset(); RoutingRule oRule = new RoutingRule(_mockServer, ""); oRule.UseCallLanguage = false; _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", StatusCode = 404 }); var res = oRule.Update(); Assert.IsFalse(res.Success, "Calling Update with error response should fail"); }