Skip to content

Commit 159ab12

Browse files
committed
Merge pull request #430 from topas/master
XmlDeserializer shoud be parent class of XmlAttributeDeserializer
2 parents fb68cad + 8446a4a commit 159ab12

File tree

6 files changed

+1056
-407
lines changed

6 files changed

+1056
-407
lines changed

RestSharp.Tests/RestSharp.Tests.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
</Reference>
8181
</ItemGroup>
8282
<ItemGroup>
83+
<Compile Include="SampleClasses\GoogleWeatherWithAttributes.cs" />
84+
<Compile Include="XmlAttributeDeserializerTests.cs" />
8385
<Compile Include="CultureChange.cs" />
8486
<Compile Include="JsonTests.cs" />
8587
<Compile Include="Fakes\NullHttp.cs" />
@@ -103,7 +105,7 @@
103105
<Compile Include="SerializerTests.cs" />
104106
<Compile Include="SimpleJson.cs" />
105107
<Compile Include="UrlBuilderTests.cs" />
106-
<Compile Include="XmlTests.cs" />
108+
<Compile Include="XmlDeserializerTests.cs" />
107109
</ItemGroup>
108110
<ItemGroup>
109111
<Content Include="SampleData\4sq.txt">
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System.Collections.Generic;
2+
using RestSharp.Deserializers;
3+
4+
namespace RestSharp.Tests.SampleClasses
5+
{
6+
public class GoogleWeatherApi
7+
{
8+
public string Version { get; set; }
9+
public GoogleWeather Weather { get; set; }
10+
}
11+
12+
public class GoogleWeather : List<ForecastConditions>
13+
{
14+
public string ModuleId { get; set; }
15+
public string TabId { get; set; }
16+
public string MobileRow { get; set; }
17+
public string MobileZipped { get; set; }
18+
public string Row { get; set; }
19+
public string Section { get; set; }
20+
21+
[DeserializeAs(Name = "forecast_information")]
22+
public ForecastInformation Forecast { get; set; }
23+
24+
[DeserializeAs(Name = "current_conditions")]
25+
public CurrentConditions Current { get; set; }
26+
}
27+
28+
public class GoogleDataElement
29+
{
30+
public string Data { get; set; }
31+
}
32+
33+
public class ForecastInformation
34+
{
35+
public GoogleDataElement City { get; set; }
36+
public GoogleDataElement PostalCode { get; set; }
37+
public GoogleDataElement ForecastDate { get; set; }
38+
public GoogleDataElement UnitSystem { get; set; }
39+
}
40+
41+
public class CurrentConditions
42+
{
43+
public GoogleDataElement Condition { get; set; }
44+
public GoogleDataElement TempC { get; set; }
45+
public GoogleDataElement Humidity { get; set; }
46+
public GoogleDataElement Icon { get; set; }
47+
public GoogleDataElement WindCondition { get; set; }
48+
}
49+
50+
public class ForecastConditions
51+
{
52+
public GoogleDataElement DayOfWeek { get; set; }
53+
public GoogleDataElement Condition { get; set; }
54+
public GoogleDataElement Low { get; set; }
55+
public GoogleDataElement High { get; set; }
56+
public GoogleDataElement Icon { get; set; }
57+
}
58+
59+
60+
}

0 commit comments

Comments
 (0)