forked from ServiceStack/ServiceStack.Text
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelWithAllTypesTests.cs
More file actions
48 lines (40 loc) · 957 Bytes
/
ModelWithAllTypesTests.cs
File metadata and controls
48 lines (40 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using NUnit.Framework;
using ServiceStack.Text.Tests.DynamicModels;
namespace ServiceStack.Text.Tests.JsonTests
{
[TestFixture]
public class ModelWithAllTypesTests
{
[Test]
public void Can_Serialize()
{
var model = ModelWithAllTypes.Create(1);
var s = JsonSerializer.SerializeToString(model);
Console.WriteLine(s);
}
[Test]
public void Can_Serialize_list()
{
var model = new List<ModelWithAllTypes>
{
ModelWithAllTypes.Create(1),
ModelWithAllTypes.Create(2)
};
var s = JsonSerializer.SerializeToString(model);
Console.WriteLine(s);
}
[Test]
public void Can_Serialize_map()
{
var model = new Dictionary<string, ModelWithAllTypes>
{
{"A", ModelWithAllTypes.Create(1)},
{"B", ModelWithAllTypes.Create(2)},
};
var s = JsonSerializer.SerializeToString(model);
Console.WriteLine(s);
}
}
}