public void HashCodeShouldHaveSameBehaviorOfNetType() { var type = new DateTimeOffsetType(); var now = DateTimeOffset.Now; var exactClone = new DateTimeOffset(now.Ticks, now.Offset); Assert.That((now.GetHashCode() == exactClone.GetHashCode()), Is.EqualTo(now.GetHashCode() == type.GetHashCode(exactClone, EntityMode.Poco))); }
public static void AreEqual(DateTimeOffset dt1, DateTimeOffset dt2) { bool areEqual = new DateTimeOffsetType().IsEqual(dt1, dt2); if (!areEqual) Assert.Fail(string.Format("Expected {0} but was {1}", dt1, dt2)); }
public static NullableType GetDateTimeOffsetType(byte fractionalSecondsPrecision) { var key = GetKeyForLengthOrScaleBased(NHibernateUtil.DateTimeOffset.Name, fractionalSecondsPrecision); if (!typeByTypeOfName.TryGetValue(key, out var returnType)) { returnType = new DateTimeOffsetType(SqlTypeFactory.GetDateTimeOffset(fractionalSecondsPrecision)); AddToTypeOfNameWithLength(key, returnType); } return((NullableType)returnType); }
public void WhenNotEqualTicksThenShouldNotMatchIsEqual() { var type = new DateTimeOffsetType(); var now = DateTimeOffset.Now; Assert.That(type.IsEqual(new DateTimeOffset(now.Ticks - 1, now.Offset), new DateTimeOffset(now.Ticks, now.Offset)), Is.False); }
public void WhenNotEqualTicksThenShouldNotMatchIsEqual() { var type = new DateTimeOffsetType(); var now = DateTimeOffset.Now; type.IsEqual(new DateTimeOffset(now.Ticks - 1, now.Offset), new DateTimeOffset(now.Ticks, now.Offset)).Should().Be.False(); }