Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit b56a561

Browse files
committed
fix failing unit test with customizing Guid serialization format
1 parent 1e9f86b commit b56a561

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/ServiceStack.OrmLite.Tests/OrmLiteComplexTypesTests.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Linq;
33
using NUnit.Framework;
44
using ServiceStack.Common.Tests.Models;
5+
using ServiceStack.Text;
56

67
namespace ServiceStack.OrmLite.Tests
78
{
@@ -66,14 +67,15 @@ public void Lists_Of_Guids_Are_Formatted_Correctly()
6667
{
6768
using (var db = OpenDbConnection())
6869
{
69-
db.CreateTable<WithAListOfGuids>(true);
70+
db.DropAndCreateTable<WithAListOfGuids>();
7071

71-
var item = new WithAListOfGuids
72-
{
73-
GuidOne = new Guid("32cb0acb-db43-4061-a6aa-7f4902a7002a"),
74-
GuidTwo = new Guid("13083231-b005-4ff4-ab62-41bdc7f50a4d"),
75-
TheGuids = new[] { new Guid("18176030-7a1c-4288-82df-a52f71832381"), new Guid("017f986b-f7be-4b6f-b978-ff05fba3b0aa") },
76-
};
72+
JsConfig<Guid>.RawSerializeFn = x => x.ToString();
73+
74+
var item = new WithAListOfGuids {
75+
GuidOne = new Guid("32cb0acb-db43-4061-a6aa-7f4902a7002a"),
76+
GuidTwo = new Guid("13083231-b005-4ff4-ab62-41bdc7f50a4d"),
77+
TheGuids = new[] { new Guid("18176030-7a1c-4288-82df-a52f71832381"), new Guid("017f986b-f7be-4b6f-b978-ff05fba3b0aa") },
78+
};
7779

7880
db.Insert(item);
7981

@@ -85,6 +87,8 @@ public void Lists_Of_Guids_Are_Formatted_Correctly()
8587

8688
var savedGuidList = db.Select<string>("SELECT TheGuids FROM WithAListOfGuids").First();
8789
Assert.That(savedGuidList, Is.EqualTo("[18176030-7a1c-4288-82df-a52f71832381,017f986b-f7be-4b6f-b978-ff05fba3b0aa]"));
90+
91+
JsConfig.Reset();
8892
}
8993
}
9094

0 commit comments

Comments
 (0)