Example #1
0
 public static void CompareAttribute(DDValue v1, DDValue v2)
 {
     if ((v1 == null) && (v2 == null)) return;
     Assert.IsTrue(v1.Size == v2.Size, "The size of value must be the same in both values.");
     Assert.IsTrue(v1.Type == v2.Type, "The type of value must be the same in both values.");
     Assert.IsTrue(v1 == v2, "The value must be the same in both values.");
 }
Example #2
0
        static void Main(string[] args)
        {
            try
            {
                var s = new string[] {"a\0bc", "def"};

                var b2 = Encoding.UTF8.GetBytes(s[0] + "\0\0" + s[1]);

                var attr = new DDValue();
                attr.SetValue("ddddd+ыыыы");

            }
            catch (Exception e)
            {

            }

            var a = new DDNode("A");

            var b = a.Add("B");
            var c = b.Add("C");
            var z = b.Add(@".\.");
            c.Add();
            c.Add();
            c.Add();
            c.Add();
            c.Add();
            c.Add();

            c.Attributes.Add(new DDValue("value"));
            c.Attributes.Add(new DDValue("value"));
            c.Attributes.Add(new DDValue("value"));

            foreach (var node in c)
            {
                Debug.Print(node.Value.Name);
            }

            var d = a.Clone(true);
            //var ff = d.Attributes["fff"];
            // c.Add(b);

            d.Attributes.Add("ff", 123);

            var f = d.Attributes["ff"];
            var  t = d.Attributes.GetValue("ff", 56);
            var  r = d.Attributes.GetValue("fff", 56);
            d.Attributes.Add("Value");

            var ddNode = new DDNode("test");
            var ddNodeVars = ddNode.Add("Vars");
            var ddNodeActions = ddNode.Add("Actions");
            ddNodeVars.Attributes.Add("LogonName", "UserName");
            ddNodeVars.Attributes.Add("ExpectedResult", "false");
            ddNodeVars.Attributes.Add("ExpectedResult", "true", ResolveConflict.OVERWRITE);
            ddNodeVars.Attributes.GetValue("ExpectedResult", false).GetValueAsBool();
            ddNode.GetNode("/Vars").Attributes.GetValue("ExpectedResult", true).GetValueAsBool();
        }
 private void ValidateAttribute(KeyValuePair<string, DDValue> attr, string expectedKey, DDValue expectedValue)
 {
     Assert.IsTrue(attr.Key == expectedKey, "The key is incorrect.");
     Assert.IsTrue(attr.Value == expectedValue, "The value is incorrect.");
 }
 private void ValidateAttribute(KeyValuePair<string, DDValue> attr, Enum expectedKey, DDValue expectedValue)
 {
     ValidateAttribute(attr, expectedKey.ToString(), expectedValue);
 }
Example #5
0
 /// <summary>
 /// Save value ​​in the attribute Value based on the parameters passed, and / or using default values
 /// </summary>
 public void ApplyDefaultValue()
 {
     var value = new DDValue();
     if (GetResultIsOptionSpecified())
     {
         if (GetAttributeValue(DrCmdOptionSettings.ResultIsOptionSpecifiedValue, false))
         {
             value = GetAttributeValue(DrCmdOptionSettings.ResultValue, string.Empty);                                  // if option value is specified
         }
         else
         {
             value = GetAttributeValue(DrCmdOptionSettings.DefaultValueIfSpecifiedWithoutValue, string.Empty);          // if option is specified without value
         }
     }
     else
     {
         value = GetAttributeValue(DrCmdOptionSettings.DefaultValueIfNoneSpecified, string.Empty);                       // if option is not specified
     }
     Option.Attributes.Add(DrCmdOptionSettings.Value, value);
 }