public void Value_type_short() { var helper = new IdHelperForValueType<short>(); Assert.AreEqual(false, helper.IsNull(0)); Assert.AreEqual(true, helper.IsDefaultValue(0)); Assert.AreEqual(false, helper.IsDefaultValue(1)); Assert.AreEqual(true, helper.AreEqual(0, 0)); Assert.AreEqual(true, helper.AreEqual(23, 23)); Assert.AreEqual(-1, helper.Compare(0, 1)); Assert.AreEqual(+1, helper.Compare(0, -1)); Assert.That(helper.Compare(0, 0), Is.EqualTo(0)); Assert.AreEqual(0, helper.Compare(23, 23)); Assert.AreEqual(0.GetHashCode(), helper.GetHashCode(0)); Assert.AreEqual(((short)23).GetHashCode(), helper.GetHashCode(23)); }
public void Value_type_Guid() { var helper = new IdHelperForValueType<Guid>(); var guid1 = new Guid("005faa88-a529-4065-9d04-72a96316988b"); var guid2 = new Guid("64b9dd7a-f46e-448b-b6e5-ddd3f83ec508"); Assert.AreEqual(false, helper.IsNull(Guid.Empty)); Assert.AreEqual(true, helper.IsDefaultValue(Guid.Empty)); Assert.AreEqual(false, helper.IsDefaultValue(guid1)); Assert.AreEqual(true, helper.AreEqual(Guid.Empty, Guid.Empty)); Assert.AreEqual(true, helper.AreEqual(guid1, guid1)); Assert.AreEqual(-1, helper.Compare(Guid.Empty, guid1)); Assert.AreEqual(+1, helper.Compare(guid2, Guid.Empty)); Assert.That(helper.Compare(Guid.Empty, Guid.Empty), Is.EqualTo(0)); Assert.AreEqual(0, helper.Compare(guid2, guid2)); Assert.AreEqual(Guid.Empty.GetHashCode(), helper.GetHashCode(Guid.Empty)); Assert.AreEqual(guid1.GetHashCode(), helper.GetHashCode(guid1)); }