Skip to content

Commit 18f7853

Browse files
committed
Undo cosmetic changes
1 parent 1e01833 commit 18f7853

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

RestSharp.Tests/JsonTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
// distributed under the License is distributed on an "AS IS" BASIS,
1313
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
// See the License for the specific language governing permissions and
15-
// limitations under the License.
15+
// limitations under the License.
1616

17-
#endregion License
17+
#endregion
1818

19-
using NUnit.Framework;
20-
using RestSharp.Deserializers;
21-
using RestSharp.Tests.SampleClasses;
2219
using System;
2320
using System.Collections;
2421
using System.Collections.Generic;
2522
using System.Globalization;
2623
using System.IO;
2724
using System.Linq;
25+
using NUnit.Framework;
26+
using RestSharp.Deserializers;
27+
using RestSharp.Tests.SampleClasses;
2828

2929
namespace RestSharp.Tests
3030
{
@@ -195,7 +195,7 @@ public void Can_Deserialize_List_of_Guid()
195195
data["Ids"] = new JsonArray { id1, id2 };
196196

197197
JsonDeserializer d = new JsonDeserializer();
198-
RestResponse response = new RestResponse { Content = data.ToString() };
198+
RestResponse response = new RestResponse { Content = data.ToString() };
199199
GuidList p = d.Deserialize<GuidList>(response);
200200

201201
Assert.AreEqual(2, p.Ids.Count);
@@ -1024,4 +1024,4 @@ private static T GetPayLoad<T>(string fileName)
10241024
return d.Deserialize<T>(response);
10251025
}
10261026
}
1027-
}
1027+
}

RestSharp/Deserializers/JsonDeserializer.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using RestSharp.Extensions;
2-
using System;
1+
using System;
32
using System.Collections;
43
using System.Collections.Generic;
54
using System.Globalization;
65
using System.Linq;
76
using System.Reflection;
7+
using RestSharp.Extensions;
88

99
namespace RestSharp.Deserializers
1010
{
@@ -68,7 +68,7 @@ private object Map(object target, IDictionary<string, object> data)
6868

6969
if (attributes.Length > 0)
7070
{
71-
DeserializeAsAttribute attribute = (DeserializeAsAttribute)attributes[0];
71+
DeserializeAsAttribute attribute = (DeserializeAsAttribute) attributes[0];
7272
name = attribute.Name;
7373
}
7474
else
@@ -96,7 +96,7 @@ private object Map(object target, IDictionary<string, object> data)
9696
}
9797
else
9898
{
99-
currentData = (IDictionary<string, object>)currentData[actualName];
99+
currentData = (IDictionary<string, object>) currentData[actualName];
100100
}
101101
}
102102

@@ -111,11 +111,11 @@ private object Map(object target, IDictionary<string, object> data)
111111

112112
private IDictionary BuildDictionary(Type type, object parent)
113113
{
114-
IDictionary dict = (IDictionary)Activator.CreateInstance(type);
114+
IDictionary dict = (IDictionary) Activator.CreateInstance(type);
115115
Type keyType = type.GetGenericArguments()[0];
116116
Type valueType = type.GetGenericArguments()[1];
117117

118-
foreach (KeyValuePair<string, object> child in (IDictionary<string, object>)parent)
118+
foreach (KeyValuePair<string, object> child in (IDictionary<string, object>) parent)
119119
{
120120
object key = keyType != typeof(string)
121121
? Convert.ChangeType(child.Key, keyType, CultureInfo.InvariantCulture)
@@ -140,15 +140,15 @@ private IDictionary BuildDictionary(Type type, object parent)
140140

141141
private IList BuildList(Type type, object parent)
142142
{
143-
IList list = (IList)Activator.CreateInstance(type);
143+
IList list = (IList) Activator.CreateInstance(type);
144144
Type listType = type.GetInterfaces()
145145
.First
146146
(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IList<>));
147147
Type itemType = listType.GetGenericArguments()[0];
148148

149149
if (parent is IList)
150150
{
151-
foreach (object element in (IList)parent)
151+
foreach (object element in (IList) parent)
152152
{
153153
if (itemType.IsPrimitive)
154154
{
@@ -251,14 +251,14 @@ private object ConvertValue(Type type, object value)
251251

252252
if (type == typeof(DateTimeOffset))
253253
{
254-
return (DateTimeOffset)dt;
254+
return (DateTimeOffset) dt;
255255
}
256256
}
257257
else if (type == typeof(decimal))
258258
{
259259
if (value is double)
260260
{
261-
return (decimal)((double)value);
261+
return (decimal) ((double) value);
262262
}
263263

264264
if (stringValue.Contains("e"))
@@ -310,7 +310,7 @@ private object ConvertValue(Type type, object value)
310310
}
311311
else if (type == typeof(JsonObject))
312312
{
313-
// simplify JsonObject into a Dictionary<string, object>
313+
// simplify JsonObject into a Dictionary<string, object>
314314
return this.BuildDictionary(typeof(Dictionary<string, object>), value);
315315
}
316316
else
@@ -326,9 +326,9 @@ private object CreateAndMap(Type type, object element)
326326
{
327327
object instance = Activator.CreateInstance(type);
328328

329-
this.Map(instance, (IDictionary<string, object>)element);
329+
this.Map(instance, (IDictionary<string, object>) element);
330330

331331
return instance;
332332
}
333333
}
334-
}
334+
}

0 commit comments

Comments
 (0)