public void オブジェクトを引数にして生成します() { var target = new TypeConvertableWrapper(new Object()); Assert.IsNotNull(target); Assert.IsInstanceOfType(target, typeof(TypeConvertableWrapper)); }
public void MyTestInitialize() { _BoolData = new TypeConvertableWrapper(false); _ByteData = new TypeConvertableWrapper(Byte.Parse("255")); _DateTimeData = new TypeConvertableWrapper(new DateTime(2009, 4, 7)); _DateTimeNullData = new TypeConvertableWrapper(null); _DecimalData = new TypeConvertableWrapper(new Decimal(123.456)); _DecimalNullData = new TypeConvertableWrapper(null); _DoubleData = new TypeConvertableWrapper(456.789d); _IntData = new TypeConvertableWrapper(-100); _Int16Data = new TypeConvertableWrapper(30000); _Int64Data = new TypeConvertableWrapper(4000000000); _StringData = new TypeConvertableWrapper("ABC"); _UIntData = new TypeConvertableWrapper(100); }
public void Null許容DateTimeのテスト() { DateTime?a = null; var target = new SqlStatement("aaa").Replace("aa", a); Assert.AreEqual <string>("aaa", target); var b = new TypeConvertableWrapper(a); Assert.AreEqual <DateTime>(TypeConvertableWrapper.DateTimeDefault, b.DateTime); Assert.AreEqual <DateTime?>(null, b.DateTimeNull); var c = DateTime.Now; var d = new TypeConvertableWrapper(c); Assert.AreEqual <DateTime>(c, d.DateTime); Assert.AreEqual <DateTime?>(new DateTime?(c), d.DateTimeNull); }
private static void SetData(SqlCeUpdatableRecord rec, int index, Type type, TypeConvertableWrapper col) { switch (Type.GetTypeCode(type.GetType())) { case TypeCode.String: rec.SetString(index, col.String); break; case TypeCode.Int16: rec.SetInt16(index, col.Int16); break; case TypeCode.Int32: rec.SetInt32(index, col.Int); break; case TypeCode.Int64: rec.SetInt64(index, col.Int); break; case TypeCode.Byte: rec.SetSqlByte(index, col.Byte); break; case TypeCode.DateTime: rec.SetSqlDateTime(index, col.DateTime); break; case TypeCode.Decimal: rec.SetDecimal(index, col.Decimal); break; default: throw new ArgumentException(Type.GetTypeCode(type.GetType()).ToString() + "型には対応していません。"); } }