Provides additional properties for column types with associated enumerations.
Наследование: IConvertible, IFormattable
Пример #1
0
        public void AttributeColumnNames()
        {
            var expected = Enum.GetNames(typeof(ComponentAttributes));
            var actual = new AttributeColumn(typeof(ComponentAttributes), 0).GetNames().ToArray();

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #2
0
        public void AttributeColumnToEnumString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value  = column.ToString("F");

            Assert.AreEqual <string>("Shared", value);
        }
Пример #3
0
        public void AttributeColumnNames()
        {
            var expected = Enum.GetNames(typeof(ComponentAttributes));
            var actual   = new AttributeColumn(typeof(ComponentAttributes), 0).GetNames().ToArray();

            CollectionAssert.AreEqual(expected, actual);
        }
Пример #4
0
        public void AttributeColumnToHexString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value  = column.ToString("X8");

            Assert.AreEqual <string>("0x00000800", value);
        }
Пример #5
0
 public void AttributeColumnEquality()
 {
     var column = new AttributeColumn(null, 0);
     Assert.IsTrue(column.Equals(new AttributeColumn(null, 0)));
     Assert.IsTrue(column.Equals(new AttributeColumn(typeof(ComponentAttributes), 0)));
     Assert.IsFalse(column.Equals(null));
     Assert.IsFalse(column.Equals(0));
 }
Пример #6
0
        public void AttributeColumnEquality()
        {
            var column = new AttributeColumn(null, 0);

            Assert.IsTrue(column.Equals(new AttributeColumn(null, 0)));
            Assert.IsTrue(column.Equals(new AttributeColumn(typeof(ComponentAttributes), 0)));
            Assert.IsFalse(column.Equals(null));
            Assert.IsFalse(column.Equals(0));
        }
Пример #7
0
        public void AttributeColumnToString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value  = column.ToString();

            Assert.AreEqual <string>("2048", value);

            column = new AttributeColumn(null, null);
            Assert.IsNull(column.ToString());
        }
Пример #8
0
        public void AttributeColumnHasValue()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), 260);
            Assert.IsTrue(column.HasValue("RegistryKeyPath"));
            Assert.IsTrue(column.HasValue("SixtyFourBit"));
            Assert.IsFalse(column.HasValue("None"));

            column = new AttributeColumn(typeof(ComponentAttributes), 0);
            Assert.IsFalse(column.HasValue("RegistryKeyPath"));
            Assert.IsFalse(column.HasValue("SixtyFourBit"));
            Assert.IsTrue(column.HasValue("None"));

            Assert.IsFalse(column.HasValue("Invalid"));
        }
Пример #9
0
        public void AttributeColumnHasValue()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), 260);

            Assert.IsTrue(column.HasValue("RegistryKeyPath"));
            Assert.IsTrue(column.HasValue("SixtyFourBit"));
            Assert.IsFalse(column.HasValue("None"));

            column = new AttributeColumn(typeof(ComponentAttributes), 0);
            Assert.IsFalse(column.HasValue("RegistryKeyPath"));
            Assert.IsFalse(column.HasValue("SixtyFourBit"));
            Assert.IsTrue(column.HasValue("None"));

            Assert.IsFalse(column.HasValue("Invalid"));
        }
Пример #10
0
        public void IConvertibleConversions()
        {
            var column = new AttributeColumn(null, 0) as IConvertible;

            Assert.AreEqual <TypeCode>(TypeCode.Int32, column.GetTypeCode());
            Assert.IsFalse(column.ToBoolean(CultureInfo.InvariantCulture));
            Assert.AreEqual <byte>(0, column.ToByte(CultureInfo.InvariantCulture));
            Assert.AreEqual <char>('\0', column.ToChar(CultureInfo.InvariantCulture));
            Assert.AreEqual <decimal>(0, column.ToDecimal(CultureInfo.InvariantCulture));
            Assert.AreEqual <double>(0, column.ToDouble(CultureInfo.InvariantCulture));
            Assert.AreEqual <short>(0, column.ToInt16(CultureInfo.InvariantCulture));
            Assert.AreEqual <int>(0, column.ToInt16(CultureInfo.InvariantCulture));
            Assert.AreEqual <long>(0, column.ToInt64(CultureInfo.InvariantCulture));
            Assert.AreEqual <sbyte>(0, column.ToSByte(CultureInfo.InvariantCulture));
            Assert.AreEqual <float>(0, column.ToSingle(CultureInfo.InvariantCulture));
            Assert.AreEqual("0", column.ToString(CultureInfo.InvariantCulture));
            Assert.AreEqual("0", column.ToType(typeof(string), CultureInfo.InvariantCulture));
            Assert.AreEqual <ushort>(0, column.ToUInt16(CultureInfo.InvariantCulture));
            Assert.AreEqual <uint>(0, column.ToUInt32(CultureInfo.InvariantCulture));
            Assert.AreEqual <ulong>(0, column.ToUInt64(CultureInfo.InvariantCulture));
        }
Пример #11
0
 public void AttributeColumnHashCode()
 {
     var column = new AttributeColumn(null, 0);
     Assert.AreEqual<int>(0, column.GetHashCode());
 }
Пример #12
0
 public void UnsupportedFormatThrows()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("Z");
 }
Пример #13
0
 public void IConvertibleConversions()
 {
     var column = new AttributeColumn(null, 0) as IConvertible;
     Assert.AreEqual<TypeCode>(TypeCode.Int32, column.GetTypeCode());
     Assert.IsFalse(column.ToBoolean(CultureInfo.InvariantCulture));
     Assert.AreEqual<byte>(0, column.ToByte(CultureInfo.InvariantCulture));
     Assert.AreEqual<char>('\0', column.ToChar(CultureInfo.InvariantCulture));
     Assert.AreEqual<decimal>(0, column.ToDecimal(CultureInfo.InvariantCulture));
     Assert.AreEqual<double>(0, column.ToDouble(CultureInfo.InvariantCulture));
     Assert.AreEqual<short>(0, column.ToInt16(CultureInfo.InvariantCulture));
     Assert.AreEqual<int>(0, column.ToInt16(CultureInfo.InvariantCulture));
     Assert.AreEqual<long>(0, column.ToInt64(CultureInfo.InvariantCulture));
     Assert.AreEqual<sbyte>(0, column.ToSByte(CultureInfo.InvariantCulture));
     Assert.AreEqual<float>(0, column.ToSingle(CultureInfo.InvariantCulture));
     Assert.AreEqual("0", column.ToString(CultureInfo.InvariantCulture));
     Assert.AreEqual("0", column.ToType(typeof(string), CultureInfo.InvariantCulture));
     Assert.AreEqual<ushort>(0, column.ToUInt16(CultureInfo.InvariantCulture));
     Assert.AreEqual<uint>(0, column.ToUInt32(CultureInfo.InvariantCulture));
     Assert.AreEqual<ulong>(0, column.ToUInt64(CultureInfo.InvariantCulture));
 }
Пример #14
0
        public void AttributeColumnHashCode()
        {
            var column = new AttributeColumn(null, 0);

            Assert.AreEqual <int>(0, column.GetHashCode());
        }
Пример #15
0
 public void UnsupportedFormatThrows()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value  = column.ToString("Z");
 }
Пример #16
0
 public void AttributeColumnToEnumString()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("F");
     Assert.AreEqual<string>("Shared", value);
 }
Пример #17
0
 public void AttributeColumnToHexString()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("X8");
     Assert.AreEqual<string>("0x00000800", value);
 }
Пример #18
0
        public void AttributeColumnToString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value = column.ToString();
            Assert.AreEqual<string>("2048", value);

            column = new AttributeColumn(null, null);
            Assert.IsNull(column.ToString());
        }