public void TestIsMatchBlackberry() { IRouter mtaRouter = new Workshare.Policy.Routing.MtaRouter.MtaRouter(); PolicyType policyType = PolicyType.Mta; IUniversalRoutingEntity sourceEntity = new UniversalRoutingEntity(); sourceEntity.PolicyType = policyType; sourceEntity.RoutingType = Workshare.Policy.Routing.RoutingTypes.Source; sourceEntity.Properties.Add(SMTPPropertyKeys.RequestChannel, RequestChannels.Blackberry); IRoutingItem routingItem = new RoutingItem("[email protected]"); routingItem.Properties.Add(SMTPItemPropertyKeys.DisplayName, "[email protected]"); sourceEntity.Items.Add(routingItem); IUniversalRoutingEntity targetEntity = new UniversalRoutingEntity(); targetEntity.PolicyType = policyType; targetEntity.RoutingType = Workshare.Policy.Routing.RoutingTypes.Source; routingItem = new RoutingItem("[email protected]"); routingItem.Properties.Add(SMTPItemPropertyKeys.DisplayName, "[email protected]"); targetEntity.Items.Add(routingItem); //invalid data Assert.IsFalse(mtaRouter.IsMatch(null, null), "Expected null data to return false"); Assert.IsFalse(mtaRouter.IsMatch(sourceEntity, null), "Expected null data to return false"); Assert.IsFalse(mtaRouter.IsMatch(null, targetEntity), "Expected null data to return false"); Assert.IsTrue(mtaRouter.IsMatch(sourceEntity, targetEntity), "Expected nominal case to return true"); }
private void IsMatchMailServer(string requestChannel) { IRouter mtaRouter = new Workshare.Policy.Routing.MtaRouter.MtaRouter(); PolicyType policyType = PolicyType.Mta; IUniversalRoutingEntity sourceEntity = new UniversalRoutingEntity(); sourceEntity.PolicyType = policyType; sourceEntity.RoutingType = Workshare.Policy.Routing.RoutingTypes.Source; if (!string.IsNullOrEmpty(requestChannel)) sourceEntity.Properties.Add(SMTPPropertyKeys.RequestChannel, requestChannel); IRoutingItem routingItem = new RoutingItem("[email protected]"); routingItem.Properties.Add(SMTPItemPropertyKeys.DisplayName, "[email protected]"); sourceEntity.Items.Add(routingItem); IUniversalRoutingEntity targetEntity = new UniversalRoutingEntity(); targetEntity.PolicyType = policyType; targetEntity.RoutingType = Workshare.Policy.Routing.RoutingTypes.Source; routingItem = new RoutingItem("[email protected]"); routingItem.Properties.Add(SMTPItemPropertyKeys.DisplayName, "[email protected]"); targetEntity.Items.Add(routingItem); //invalid data Assert.IsFalse(mtaRouter.IsMatch(null, null), "Expected null data to return false"); Assert.IsFalse(mtaRouter.IsMatch(sourceEntity, null), "Expected null data to return false"); Assert.IsFalse(mtaRouter.IsMatch(null, targetEntity), "Expected null data to return false"); Assert.IsFalse(mtaRouter.IsMatch(sourceEntity, targetEntity), "Expected nominal case to return false"); }
public void TestIsEnabled() { IRouter mtaRouter = new Workshare.Policy.Routing.MtaRouter.MtaRouter(); Assert.IsTrue(mtaRouter.IsEnabled(), "device router should be enabled"); }