Last active
December 11, 2015 12:18
-
-
Save shiftkey/4599342 to your computer and use it in GitHub Desktop.
Repro: DateTimeOffset support missing in ServiceStack.OrmLite.SqlServer (supported in SQL Server 2008+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NUnit.Framework; | |
using ServiceStack.OrmLite.SqlServer; | |
namespace ServiceStack.OrmLite.SqlServerTests | |
{ | |
[TestFixture] | |
public class DateTimeOffsetTests | |
{ | |
// NOTE: ISO 8601 says no whitespace between time value and timezone parameter | |
// SQL Server happily accepts this format | |
[Test] | |
public void DateTimeOffset_Is_Not_Formatted_As_Per_ISO_8601() | |
{ | |
// arrange | |
var subject = new SqlServerOrmLiteDialectProvider(); | |
var now = DateTimeOffset.Now; | |
var expected = string.Format("'{0}'", now.ToString("yyyy-MM-dd HH:mm:ss.fff zzz")); | |
// act | |
var output = subject.GetQuotedValue(now, typeof(DateTimeOffset)); | |
Assert.AreEqual(expected, output); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Expected string length 32 but was 30. Strings differ at index 2. | |
Expected: "'2013-01-23 09:29:42.898 +11:00'" | |
But was: "'23/01/2013 9:29:42 AM +11:00'" | |
-------------^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Already raised here: ServiceStack/ServiceStack.OrmLite#102