Skip to content

Commit 1f1deb5

Browse files
committed
Specialized tests for PostgreSQL
1 parent 850ba3d commit 1f1deb5

File tree

1 file changed

+22
-1
lines changed
  • Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTimeOffset

1 file changed

+22
-1
lines changed

Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTimeOffset/OperationsTest.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Created by: Alex Groznov
55
// Created: 2016.08.01
66

7+
using System;
78
using NUnit.Framework;
89
using Xtensive.Orm.Tests.Linq.DateTimeAndDateTimeOffset.Model;
910

@@ -216,7 +217,7 @@ public void MinusDateTimeOffsetAndIntervalUsageTest()
216217
});
217218
}
218219

219-
[Test(Description = "Will fail for PostgreSql because of its restrictions")]
220+
[Test]
220221
public void ToUniversalTime()
221222
{
222223
Require.ProviderIsNot(StorageProvider.PostgreSql, "ToUniversalTime is not supported");
@@ -226,5 +227,25 @@ public void ToUniversalTime()
226227
RunTest<SingleDateTimeOffsetEntity>(c => c.NullableDateTimeOffset.Value.ToUniversalTime() == NullableDateTimeOffset.ToUniversalTime());
227228
});
228229
}
230+
231+
[Test]
232+
public void ToUniversalTimePostgresql()
233+
{
234+
Require.ProviderIs(StorageProvider.PostgreSql, "ToUniversalTime is not supported");
235+
ExecuteInsideSession(() => {
236+
var ex = Assert.Throws<QueryTranslationException>(()=> RunTest<SingleDateTimeOffsetEntity>(c => c.DateTimeOffset.ToUniversalTime() == FirstDateTimeOffset.ToUniversalTime()));
237+
Assert.That(ex.InnerException, Is.TypeOf<NotSupportedException>());
238+
});
239+
}
240+
241+
[Test]
242+
public void ToLocalTimePostgresql()
243+
{
244+
Require.ProviderIs(StorageProvider.PostgreSql, "ToLocalTime is not supported");
245+
ExecuteInsideSession(() => {
246+
var ex = Assert.Throws<QueryTranslationException>(() => RunTest<SingleDateTimeOffsetEntity>(c => c.DateTimeOffset.ToLocalTime() == FirstDateTimeOffset.ToLocalTime()));
247+
Assert.That(ex.InnerException, Is.TypeOf<NotSupportedException>());
248+
});
249+
}
229250
}
230251
}

0 commit comments

Comments
 (0)