public void EnumValue() { Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2?> .From((int?)1)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From(Enum2.Value1)); Assert.AreEqual(Enum2.Value2, ConvertTo <Enum2> .From(Enum3.Value2)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From(1)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From((int?)1)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2?> .From(1)); Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3> .From(1.0)); Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3?> .From(1.0)); Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3?> .From((double?)1.0)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("1")); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("+1")); Assert.AreEqual("Value1", ConvertTo <string> .From(Enum2.Value1)); Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("Value1")); Assert.AreEqual(Enum2.Value2, ConvertTo <Enum2> .From("value2")); }
public void ConvertTo() { Assert.AreEqual(10, ConvertTo <TestData1> .From(10).Value); Assert.AreEqual(10, ConvertTo <TestData2> .From(10).Value); }
public void ConvertFromNullableEnum2() { Assert.AreEqual(10, ConvertTo <int> .From((Enum15?)Enum15.AA)); Assert.AreEqual(0, ConvertTo <int> .From((Enum15?)null)); Assert.AreEqual(null, ConvertTo <int?> .From((Enum15?)null)); }
public void ToObject() { Assert.AreEqual(1, ConvertTo <object> .From(1)); }
public void ConvertToEnum11() { Assert.AreEqual(Enum11.Value1, ConvertTo <Enum11> .From(Enum10.Value2)); Assert.AreEqual(Enum11.Value2, ConvertTo <Enum11> .From(Enum10.Value1)); Assert.AreEqual(Enum11.Value3, ConvertTo <Enum11> .From(Enum10.Value3)); }
public void ConvertFromEnum5() { Assert.AreEqual(10, ConvertTo <int> .From(Enum9.Value1)); Assert.AreEqual(2, ConvertTo <int> .From(Enum9.Value2)); }
public void ConvertToEnum10() { Assert.AreEqual(Enum9.Value1, ConvertTo <Enum9> .From(1)); Assert.AreEqual(Enum9.Value1, ConvertTo <Enum9> .From(10)); Assert.AreEqual(Enum9.Value2, ConvertTo <Enum9> .From(2)); }
public void ConvertToEnum9() { Assert.AreEqual(Enum7.Value2, ConvertTo <Enum7> .From(Enum8.Value1)); }
public void ConvertToEnum7() { Assert.AreEqual(Enum5.Value2, ConvertTo <Enum5> .From((Enum6?)Enum6.Value1)); }
public void ConvertToEnum2() { Assert.AreEqual(Enum6.Value2, ConvertTo <Enum6> .From(Enum5.Value1)); }
public void ConvertToEnum1() { Assert.AreEqual(Enum4.Value2, ConvertTo <Enum4> .From(25)); }
public void FromValue() { Assert.AreEqual(10, ConvertTo <int> .From(new System.Data.SqlTypes.SqlInt32(10))); }
public void ParseChar() { Assert.AreEqual('\0', ConvertTo <char> .From((string?)null)); Assert.AreEqual('\0', ConvertTo <char> .From("")); }
public void Parse() { Assert.AreEqual(10, ConvertTo <int> .From("10")); Assert.AreEqual(new DateTime(2012, 1, 1), ConvertTo <DateTime> .From("2012-1-1")); }
public void FromValue() { Assert.AreEqual(10, ConvertTo <int> .From(new SqlInt32(10))); }