Exemplo n.º 1
0
        public void CanCreateCustomMatchingRuleNodeFromData()
        {
            CustomMatchingRuleData ruleData = new CustomMatchingRuleData();

            ruleData.Name     = "CustomAttributeRuleName";
            ruleData.TypeName = "custom ruleType";
            ruleData.Attributes.Add("Attribute1", "Value1");
            ruleData.Attributes.Add("Attribute2", "Value2");

            CustomMatchingRuleNode ruleNode = new CustomMatchingRuleNode(ruleData);

            Assert.AreEqual(ruleData.Name, ruleNode.Name);
            Assert.AreEqual(ruleData.TypeName, ruleNode.Type);
            Assert.AreEqual(ruleData.Attributes.Count, ruleNode.Attributes.Count);
            Assert.AreEqual(ruleData.Attributes[0], ruleNode.Attributes[0].Value);
            Assert.AreEqual(ruleData.Attributes.AllKeys[0], ruleNode.Attributes[0].Key);
            Assert.AreEqual(ruleData.Attributes[1], ruleNode.Attributes[1].Value);
            Assert.AreEqual(ruleData.Attributes.AllKeys[1], ruleNode.Attributes[1].Key);
        }
Exemplo n.º 2
0
        public void CanCreateRuleDataFromCustomMatchingRuleNode()
        {
            CustomMatchingRuleNode ruleNode = new CustomMatchingRuleNode();

            ruleNode.Name = "RuleName";
            ruleNode.Type = "custom rule type";
            ruleNode.Attributes.Add(new Microsoft.Practices.EnterpriseLibrary.Configuration.Design.EditableKeyValue("Key1", "value1"));
            ruleNode.Attributes.Add(new Microsoft.Practices.EnterpriseLibrary.Configuration.Design.EditableKeyValue("Key2", "value2"));

            CustomMatchingRuleData ruleData = ruleNode.GetConfigurationData() as CustomMatchingRuleData;

            Assert.IsNotNull(ruleData);
            Assert.AreEqual(ruleNode.Name, ruleData.Name);
            Assert.AreEqual(ruleNode.Type, ruleData.TypeName);
            Assert.AreEqual(ruleNode.Attributes[0].Key, ruleData.Attributes.AllKeys[0]);
            Assert.AreEqual(ruleNode.Attributes[0].Value, ruleData.Attributes[0]);
            Assert.AreEqual(ruleNode.Attributes[1].Key, ruleData.Attributes.AllKeys[1]);
            Assert.AreEqual(ruleNode.Attributes[1].Value, ruleData.Attributes[1]);
        }
Exemplo n.º 3
0
        public void CustomMatchingRuleNodeHasProperDefaultName()
        {
            CustomMatchingRuleNode ruleNode = new CustomMatchingRuleNode();

            Assert.AreEqual("Custom Matching Rule", ruleNode.Name);
        }