Esempio n. 1
0
        public void ValuesNullCanBeUsed()
        {
            foreach (MI_Type type in Enum.GetValues(typeof(MI_Type)))
            {
                string propertyName = type.ToString() + "_Null";
                var    res          = this.instance.AddElement(propertyName, MI_Value.Null, type, MI_Flags.MI_FLAG_NULL);
                MIAssert.Succeeded(res, "Expect add element to succeed for {0}", propertyName);

                MI_Value returnedValue = null;
                MI_Type  elementType;
                MI_Flags elementFlags = 0;
                UInt32   elementIndex = 0;
                res = instance.GetElement(propertyName, out returnedValue, out elementType, out elementFlags, out elementIndex);
                MIAssert.Succeeded(res, "Expect to get element by name");
                var testproperty = new TestMIProperty(returnedValue, elementType, elementFlags);
                MIAssert.MIPropertiesEqual(new TestMIProperty(this.value, type, MI_Flags.MI_FLAG_NULL), testproperty, propertyName);
            }
        }
Esempio n. 2
0
        private void TestValueRoundtrip()
        {
            Assert.True(this.value.Type.HasValue, "Expect value to have a value before calling helper");
            string propertyName = this.value.Type.ToString();
            var    res          = this.instance.AddElement(propertyName, this.value, this.value.Type.Value, MI_Flags.MI_FLAG_BORROW);

            MIAssert.Succeeded(res, "Expect add element to succeed");

            MI_Value returnedValue = null;
            MI_Type  elementType;
            MI_Flags elementFlags = 0;
            UInt32   elementIndex = 0;

            res = instance.GetElement(propertyName, out returnedValue, out elementType, out elementFlags, out elementIndex);
            MIAssert.Succeeded(res, "Expect to get element by name");
            var testproperty = new TestMIProperty(returnedValue, elementType, elementFlags);

            MIAssert.MIPropertiesEqual(new TestMIProperty(this.value, this.value.Type.Value, MI_Flags.None), testproperty, propertyName);
        }