public void EqualsToDateTimeOffsetWithAnotherOffset() { ExecuteInsideSession(() => { RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(FirstOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(SecondOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToOffset(TimeSpan.Zero)); RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToLocalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == FirstDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(FirstOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(SecondOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToOffset(TimeSpan.Zero)); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToLocalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == FirstMillisecondDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(FirstOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(SecondOffset)); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToOffset(TimeSpan.Zero)); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToLocalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == NullableDateTimeOffset.ToUniversalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(FirstOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(SecondOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToOffset(TimeSpan.Zero)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToLocalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset == WrongDateTimeOffset.ToUniversalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(FirstOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(SecondOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToOffset(TimeSpan.Zero)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToLocalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset == WrongMillisecondDateTimeOffset.ToUniversalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(FirstOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(SecondOffset)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToOffset(TimeSpan.Zero)); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToLocalTime()); RunWrongTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset == WrongDateTimeOffset.ToUniversalTime()); }); }
public void ToUniversalTime() { Require.ProviderIsNot(StorageProvider.PostgreSql, "ToUniversalTime is not supported"); ExecuteInsideSession(() => { RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset.ToUniversalTime() == FirstDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset.ToUniversalTime() == FirstMillisecondDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset.Value.ToUniversalTime() == NullableDateTimeOffset.ToUniversalTime()); }); }
public void ToUniversalTimePostgresql() { Require.ProviderIs(StorageProvider.PostgreSql, "ToUniversalTime is not supported"); ExecuteInsideSession(() => { var ex = Assert.Throws <QueryTranslationException>(() => RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset.ToUniversalTime() == FirstDateTimeOffset.ToUniversalTime())); Assert.That(ex.InnerException, Is.TypeOf <NotSupportedException>()); }); }
public void ToUniversalTime() { ExecuteInsideSession(() => { RunTest <SingleDateTimeOffsetEntity>(c => c.DateTimeOffset.ToUniversalTime() == FirstDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.MillisecondDateTimeOffset.ToUniversalTime() == FirstMillisecondDateTimeOffset.ToUniversalTime()); RunTest <SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset.Value.ToUniversalTime() == NullableDateTimeOffset.ToUniversalTime()); }); }