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

Commit 0cc91a7

Browse files
committed
fix whitespace
1 parent 4fac8da commit 0cc91a7

File tree

1 file changed

+89
-87
lines changed

1 file changed

+89
-87
lines changed

tests/ServiceStack.Text.Tests/DynamicObjectTests.cs

Lines changed: 89 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -5,72 +5,74 @@
55

66
namespace ServiceStack.Text.Tests
77
{
8-
[TestFixture]
9-
public class DynamicObjectTests
10-
: TestBase
11-
{
12-
public class UrlStatus
13-
{
14-
public int Status { get; set; }
15-
public string Url { get; set; }
16-
}
8+
[TestFixture]
9+
public class DynamicObjectTests
10+
: TestBase
11+
{
12+
public class UrlStatus
13+
{
14+
public int Status { get; set; }
15+
public string Url { get; set; }
16+
}
1717

1818
[TearDown]
1919
public void TearDown()
2020
{
2121
JsConfig.Reset();
2222
}
2323

24-
[Test]
25-
public void Dictionary_Object_UrlStatus()
26-
{
27-
var urlStatus = new UrlStatus {
28-
Status = 301,
29-
Url = "http://www.ehow.com/how_5615409_create-pdfs-using-bean.html",
30-
};
31-
32-
var map = new Dictionary<string, object>
33-
{
34-
{"Status","OK"},
35-
{"Url","http://www.ehow.com/m/how_5615409_create-pdfs-using-bean.html"},
36-
{"Parent Url","http://www.ehow.com/mobilearticle35.xml"},
37-
{"Redirect Chai", urlStatus},
38-
};
39-
40-
var json = JsonSerializer.SerializeToString(map);
41-
var fromJson = JsonSerializer.DeserializeFromString<Dictionary<string, object>>(json);
42-
43-
Assert.That(fromJson["Status"], Is.EqualTo(map["Status"]));
44-
Assert.That(fromJson["Url"], Is.EqualTo(map["Url"]));
45-
Assert.That(fromJson["Parent Url"], Is.EqualTo(map["Parent Url"]));
46-
47-
var actualStatus = (UrlStatus)fromJson["Redirect Chai"];
48-
Assert.That(actualStatus.Status, Is.EqualTo(urlStatus.Status));
49-
Assert.That(actualStatus.Url, Is.EqualTo(urlStatus.Url));
50-
51-
Console.WriteLine("JSON: " + json);
52-
}
53-
54-
public class PocoWithKvp
55-
{
56-
public KeyValuePair<string, string>[] Values { get; set; }
57-
}
58-
59-
[Test]
60-
public void Can_Serailize_KVP_array()
61-
{
62-
var kvpArray = new[] {
63-
new KeyValuePair<string, string>("Key", "Foo"),
64-
new KeyValuePair<string, string>("Value", "Bar"),
65-
};
66-
var dto = new PocoWithKvp {
67-
Values = kvpArray
68-
};
69-
70-
Console.WriteLine(dto.ToJson());
71-
72-
Serialize(dto, includeXml: false);
73-
}
24+
[Test]
25+
public void Dictionary_Object_UrlStatus()
26+
{
27+
var urlStatus = new UrlStatus
28+
{
29+
Status = 301,
30+
Url = "http://www.ehow.com/how_5615409_create-pdfs-using-bean.html",
31+
};
32+
33+
var map = new Dictionary<string, object>
34+
{
35+
{"Status","OK"},
36+
{"Url","http://www.ehow.com/m/how_5615409_create-pdfs-using-bean.html"},
37+
{"Parent Url","http://www.ehow.com/mobilearticle35.xml"},
38+
{"Redirect Chai", urlStatus},
39+
};
40+
41+
var json = JsonSerializer.SerializeToString(map);
42+
var fromJson = JsonSerializer.DeserializeFromString<Dictionary<string, object>>(json);
43+
44+
Assert.That(fromJson["Status"], Is.EqualTo(map["Status"]));
45+
Assert.That(fromJson["Url"], Is.EqualTo(map["Url"]));
46+
Assert.That(fromJson["Parent Url"], Is.EqualTo(map["Parent Url"]));
47+
48+
var actualStatus = (UrlStatus)fromJson["Redirect Chai"];
49+
Assert.That(actualStatus.Status, Is.EqualTo(urlStatus.Status));
50+
Assert.That(actualStatus.Url, Is.EqualTo(urlStatus.Url));
51+
52+
Console.WriteLine("JSON: " + json);
53+
}
54+
55+
public class PocoWithKvp
56+
{
57+
public KeyValuePair<string, string>[] Values { get; set; }
58+
}
59+
60+
[Test]
61+
public void Can_Serailize_KVP_array()
62+
{
63+
var kvpArray = new[] {
64+
new KeyValuePair<string, string>("Key", "Foo"),
65+
new KeyValuePair<string, string>("Value", "Bar"),
66+
};
67+
var dto = new PocoWithKvp
68+
{
69+
Values = kvpArray
70+
};
71+
72+
Console.WriteLine(dto.ToJson());
73+
74+
Serialize(dto, includeXml: false);
75+
}
7476

7577
[Test]
7678
public void Can_deserialize_object_string()
@@ -133,7 +135,7 @@ public void Can_deserialize_object_iso8601_datetime_with_timezone()
133135
var json = "{\"foo\":\"2012-11-20T21:37:32.87+02:00\"}";
134136
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
135137
Assert.That(deserialized, Is.InstanceOf<Dictionary<string, object>>());
136-
var datetime = ((Dictionary<string, object>) deserialized)["foo"];
138+
var datetime = ((Dictionary<string, object>)deserialized)["foo"];
137139
Assert.That(datetime, Is.InstanceOf<DateTime>());
138140
Assert.That(datetime, Is.EqualTo(new DateTime(2012, 11, 20, 19, 37, 32, 870, DateTimeKind.Utc).ToLocalTime()));
139141
}
@@ -165,16 +167,16 @@ public void Can_deserialize_object_dictionary_when_current_culture_has_decimal_c
165167
Assert.That(dict["doubleValue"], Is.InstanceOf<double>() & Is.EqualTo(double.MaxValue), "double");
166168
}
167169

168-
[Test]
169-
public void Can_deserialize_object_dictionary_with_mixed_values_and_nulls_and_empty_array()
170-
{
170+
[Test]
171+
public void Can_deserialize_object_dictionary_with_mixed_values_and_nulls_and_empty_array()
172+
{
171173
JsConfig.TryToParsePrimitiveTypeValues = true;
172174
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
173175

174-
var json = "{\"stringIntValue\": \"-13\",\"intValue\": -13,\"nullValue\": null,\"stringDecimalValue\": \"5.9\",\"decimalValue\": 5.9,\"emptyArrayValue\": [],\"stringValue\": \"Foo\",\"stringWithDigitsValue\": \"OR345\",\"dateValue\":\"\\/Date(785635200000)\\/\"}";
176+
var json = "{\"stringIntValue\": \"-13\",\"intValue\": -13,\"nullValue\": null,\"stringDecimalValue\": \"5.9\",\"decimalValue\": 5.9,\"emptyArrayValue\": [],\"stringValue\": \"Foo\",\"stringWithDigitsValue\": \"OR345\",\"dateValue\":\"\\/Date(785635200000)\\/\"}";
175177
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
176178
Assert.That(deserialized, Is.InstanceOf<Dictionary<string, object>>());
177-
var dict = (Dictionary<string, object>) deserialized;
179+
var dict = (Dictionary<string, object>)deserialized;
178180
Assert.That(dict["stringIntValue"], Is.EqualTo("-13"));
179181
Assert.That(dict["intValue"], Is.EqualTo(-13));
180182
Assert.That(dict["intValue"], Is.Not.EqualTo(dict["stringIntValue"]));
@@ -186,11 +188,11 @@ public void Can_deserialize_object_dictionary_with_mixed_values_and_nulls_and_em
186188
Assert.That(dict["stringValue"], Is.EqualTo("Foo"));
187189
Assert.That(dict["stringWithDigitsValue"], Is.EqualTo("OR345"));
188190
Assert.That(dict["dateValue"], Is.EqualTo(new DateTime(1994, 11, 24, 0, 0, 0, DateTimeKind.Utc)));
189-
}
191+
}
190192

191193
[Test]
192-
public void Can_deserialize_object_dictionary_with_line_breaks()
193-
{
194+
public void Can_deserialize_object_dictionary_with_line_breaks()
195+
{
194196
JsConfig.TryToParsePrimitiveTypeValues = true;
195197
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
196198

@@ -203,14 +205,14 @@ public void Can_deserialize_object_dictionary_with_line_breaks()
203205

204206
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
205207
Assert.That(deserialized, Is.InstanceOf<Dictionary<string, object>>());
206-
var dict = (Dictionary<string, object>) deserialized;
208+
var dict = (Dictionary<string, object>)deserialized;
207209
Assert.That(dict.Keys.Count, Is.EqualTo(1));
208210
Assert.That(dict["value"], Is.EqualTo(5));
209-
}
211+
}
210212

211213
[Test]
212-
public void Can_deserialize_object_array_with_line_breaks_before_first_element()
213-
{
214+
public void Can_deserialize_object_array_with_line_breaks_before_first_element()
215+
{
214216
JsConfig.TryToParsePrimitiveTypeValues = true;
215217
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
216218

@@ -221,14 +223,14 @@ public void Can_deserialize_object_array_with_line_breaks_before_first_element()
221223

222224
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
223225
Assert.That(deserialized, Is.InstanceOf<List<object>>());
224-
var arrayValues = (List<object>) deserialized;
226+
var arrayValues = (List<object>)deserialized;
225227
Assert.That(arrayValues.Count, Is.EqualTo(1));
226228
Assert.That(arrayValues[0], Is.Not.Null);
227-
}
229+
}
228230

229231
[Test]
230-
public void Can_deserialize_object_array_with_line_breaks_after_last_element()
231-
{
232+
public void Can_deserialize_object_array_with_line_breaks_after_last_element()
233+
{
232234
JsConfig.TryToParsePrimitiveTypeValues = true;
233235
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
234236

@@ -239,14 +241,14 @@ public void Can_deserialize_object_array_with_line_breaks_after_last_element()
239241

240242
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
241243
Assert.That(deserialized, Is.InstanceOf<List<object>>());
242-
var arrayValues = (List<object>) deserialized;
244+
var arrayValues = (List<object>)deserialized;
243245
Assert.That(arrayValues.Count, Is.EqualTo(1));
244246
Assert.That(arrayValues[0], Is.Not.Null);
245-
}
247+
}
246248

247249
[Test]
248-
public void Can_deserialize_object_array_with_line_breaks_around_element()
249-
{
250+
public void Can_deserialize_object_array_with_line_breaks_around_element()
251+
{
250252
JsConfig.TryToParsePrimitiveTypeValues = true;
251253
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
252254

@@ -258,14 +260,14 @@ public void Can_deserialize_object_array_with_line_breaks_around_element()
258260

259261
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
260262
Assert.That(deserialized, Is.InstanceOf<List<object>>());
261-
var arrayValues = (List<object>) deserialized;
263+
var arrayValues = (List<object>)deserialized;
262264
Assert.That(arrayValues.Count, Is.EqualTo(1));
263265
Assert.That(arrayValues[0], Is.Not.Null);
264-
}
266+
}
265267

266268
[Test]
267-
public void Can_deserialize_object_array_with_line_breaks_around_number_element()
268-
{
269+
public void Can_deserialize_object_array_with_line_breaks_around_number_element()
270+
{
269271
JsConfig.TryToParsePrimitiveTypeValues = true;
270272
JsConfig.ConvertObjectTypesIntoStringDictionary = true;
271273

@@ -277,9 +279,9 @@ public void Can_deserialize_object_array_with_line_breaks_around_number_element(
277279

278280
var deserialized = JsonSerializer.DeserializeFromString<object>(json);
279281
Assert.That(deserialized, Is.InstanceOf<List<object>>());
280-
var arrayValues = (List<object>) deserialized;
282+
var arrayValues = (List<object>)deserialized;
281283
Assert.That(arrayValues.Count, Is.EqualTo(1));
282284
Assert.That(arrayValues[0], Is.EqualTo(5));
283-
}
284-
}
285+
}
286+
}
285287
}

0 commit comments

Comments
 (0)