なぜこのテストに失敗していますか?奇妙なInt64.Equalsの動作
[Test]
public void Int64Test()
{
Int64Keys ObjBigInt = new Int64Keys();
ObjBigInt.Id = 0;
PropertyInfo p = ObjBigInt.GetType().GetProperty("Id");
var IDValue = p.GetValue(ObjBigInt, null);
//var IDType = IDValue.GetType(); //returns {System.Int64}
Assert.IsTrue(IDValue.Equals(0)); //is returning false and the type if IDValue is Int64()
}
public class Int64Keys
{
public Int64 Id { get; set; }
}
public class Int32Keys
{
public Int32 Id { get; set; }
}
public class DoubleKeys
{
public double Id { get; set; }
}
referredこの問題はこれを解決するのに十分なアイデアを得ていません。
編集: 私のインスタンスが任意のタイプ(Int32、Int64、double)になるように私はリポジトリパターンを使用しています。