ToString() публичный Метод

Returns a string representation of the internal value using the CultureInfo.InvariantCulture.
public ToString ( ) : string
Результат string
Пример #1
0
        public void AttributeColumnToEnumString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value  = column.ToString("F");

            Assert.AreEqual <string>("Shared", value);
        }
Пример #2
0
        public void AttributeColumnToHexString()
        {
            var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
            var value  = column.ToString("X8");

            Assert.AreEqual <string>("0x00000800", value);
        }
Пример #3
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());
        }
Пример #4
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));
        }
Пример #5
0
 public void AttributeColumnToHexString()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("X8");
     Assert.AreEqual<string>("0x00000800", value);
 }
Пример #6
0
 public void AttributeColumnToEnumString()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("F");
     Assert.AreEqual<string>("Shared", value);
 }
Пример #7
0
 public void UnsupportedFormatThrows()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value = column.ToString("Z");
 }
Пример #8
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));
 }
Пример #9
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());
        }
Пример #10
0
 public void UnsupportedFormatThrows()
 {
     var column = new AttributeColumn(typeof(ComponentAttributes), (int)ComponentAttributes.Shared);
     var value  = column.ToString("Z");
 }