@@ -32,29 +32,32 @@ public async Task PlayerService_IsPlayingSharedGameAsync_Return_Null_If_Web_Inte
3232 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
3333
3434 mockSteamWebRequest . Setup ( x => x . GetAsync < PlayingSharedGameResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
35- . ReturnsAsync ( ( PlayingSharedGameResultContainer ) null ) ;
35+ . ReturnsAsync ( ( ISteamWebResponse < PlayingSharedGameResultContainer > ) null ) ;
3636
3737 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
3838 var result = await service . IsPlayingSharedGameAsync ( It . IsAny < ulong > ( ) , It . IsAny < uint > ( ) ) ;
3939
40- Assert . IsTrue ( ! result . HasValue ) ;
40+ Assert . IsNull ( result ) ;
4141 }
4242
4343 [ TestMethod ]
44- public async Task PlayerService_IsPlayingSharedGameAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
44+ public async Task PlayerService_IsPlayingSharedGameAsync_Return_Null_Data_If_Web_Interface_Result_Is_Null ( )
4545 {
4646 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
4747
4848 mockSteamWebRequest . Setup ( x => x . GetAsync < PlayingSharedGameResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
49- . ReturnsAsync ( new PlayingSharedGameResultContainer ( )
49+ . ReturnsAsync ( new SteamWebResponse < PlayingSharedGameResultContainer > ( )
5050 {
51- Result = null
51+ Data = new PlayingSharedGameResultContainer ( )
52+ {
53+ Result = null
54+ }
5255 } ) ;
5356
5457 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
5558 var result = await service . IsPlayingSharedGameAsync ( It . IsAny < ulong > ( ) , It . IsAny < uint > ( ) ) ;
5659
57- Assert . IsTrue ( ! result . HasValue ) ;
60+ Assert . IsNull ( result . Data ) ;
5861 }
5962
6063 [ TestMethod ]
@@ -63,7 +66,7 @@ public async Task PlayerService_GetBadgesAsync_Return_Null_If_Web_Interface_Retu
6366 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
6467
6568 mockSteamWebRequest . Setup ( x => x . GetAsync < BadgesResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
66- . ReturnsAsync ( ( BadgesResultContainer ) null ) ;
69+ . ReturnsAsync ( ( ISteamWebResponse < BadgesResultContainer > ) null ) ;
6770
6871 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
6972 var result = await service . GetBadgesAsync ( It . IsAny < ulong > ( ) ) ;
@@ -72,20 +75,23 @@ public async Task PlayerService_GetBadgesAsync_Return_Null_If_Web_Interface_Retu
7275 }
7376
7477 [ TestMethod ]
75- public async Task PlayerService_GetBadgesAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
78+ public async Task PlayerService_GetBadgesAsync_Return_Null_Data_If_Web_Interface_Result_Is_Null ( )
7679 {
7780 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
7881
7982 mockSteamWebRequest . Setup ( x => x . GetAsync < BadgesResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
80- . ReturnsAsync ( new BadgesResultContainer ( )
83+ . ReturnsAsync ( new SteamWebResponse < BadgesResultContainer > ( )
8184 {
82- Result = null
85+ Data = new BadgesResultContainer ( )
86+ {
87+ Result = null
88+ }
8389 } ) ;
8490
8591 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
8692 var result = await service . GetBadgesAsync ( It . IsAny < ulong > ( ) ) ;
8793
88- Assert . IsNull ( result ) ;
94+ Assert . IsNull ( result . Data ) ;
8995 }
9096
9197 [ TestMethod ]
@@ -94,7 +100,7 @@ public async Task PlayerService_GetCommunityBadgeProgressAsync_Return_Null_If_We
94100 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
95101
96102 mockSteamWebRequest . Setup ( x => x . GetAsync < CommunityBadgeProgressResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
97- . ReturnsAsync ( ( CommunityBadgeProgressResultContainer ) null ) ;
103+ . ReturnsAsync ( ( ISteamWebResponse < CommunityBadgeProgressResultContainer > ) null ) ;
98104
99105 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
100106 var result = await service . GetCommunityBadgeProgressAsync ( It . IsAny < uint > ( ) , It . IsAny < uint ? > ( ) ) ;
@@ -103,20 +109,23 @@ public async Task PlayerService_GetCommunityBadgeProgressAsync_Return_Null_If_We
103109 }
104110
105111 [ TestMethod ]
106- public async Task PlayerService_GetCommunityBadgeProgressAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
112+ public async Task PlayerService_GetCommunityBadgeProgressAsync_Return_Empty_Data_If_Web_Interface_Result_Is_Null ( )
107113 {
108114 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
109115
110116 mockSteamWebRequest . Setup ( x => x . GetAsync < CommunityBadgeProgressResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
111- . ReturnsAsync ( new CommunityBadgeProgressResultContainer ( )
117+ . ReturnsAsync ( new SteamWebResponse < CommunityBadgeProgressResultContainer > ( )
112118 {
113- Result = null
119+ Data = new CommunityBadgeProgressResultContainer ( )
120+ {
121+ Result = null
122+ }
114123 } ) ;
115124
116125 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
117126 var result = await service . GetCommunityBadgeProgressAsync ( It . IsAny < uint > ( ) , It . IsAny < uint ? > ( ) ) ;
118127
119- Assert . IsNull ( result ) ;
128+ Assert . IsTrue ( result . Data . Count == 0 ) ;
120129 }
121130
122131 [ TestMethod ]
@@ -125,7 +134,7 @@ public async Task PlayerService_GetSteamLevelAsync_Return_Null_If_Web_Interface_
125134 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
126135
127136 mockSteamWebRequest . Setup ( x => x . GetAsync < SteamLevelResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
128- . ReturnsAsync ( ( SteamLevelResultContainer ) null ) ;
137+ . ReturnsAsync ( ( ISteamWebResponse < SteamLevelResultContainer > ) null ) ;
129138
130139 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
131140 var result = await service . GetSteamLevelAsync ( It . IsAny < uint > ( ) ) ;
@@ -134,20 +143,23 @@ public async Task PlayerService_GetSteamLevelAsync_Return_Null_If_Web_Interface_
134143 }
135144
136145 [ TestMethod ]
137- public async Task PlayerService_GetSteamLevelAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
146+ public async Task PlayerService_GetSteamLevelAsync_Return_Default_Data_If_Web_Interface_Result_Is_Null ( )
138147 {
139148 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
140149
141150 mockSteamWebRequest . Setup ( x => x . GetAsync < SteamLevelResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
142- . ReturnsAsync ( new SteamLevelResultContainer ( )
151+ . ReturnsAsync ( new SteamWebResponse < SteamLevelResultContainer > ( )
143152 {
144- Result = null
153+ Data = new SteamLevelResultContainer ( )
154+ {
155+ Result = null
156+ }
145157 } ) ;
146158
147159 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
148- var result = await service . GetSteamLevelAsync ( It . IsAny < uint > ( ) ) ;
160+ var result = await service . GetSteamLevelAsync ( It . IsAny < ulong > ( ) ) ;
149161
150- Assert . IsNull ( result ) ;
162+ Assert . IsNull ( result . Data ) ;
151163 }
152164
153165 [ TestMethod ]
@@ -156,7 +168,7 @@ public async Task PlayerService_GetOwnedGamesAsync_Return_Null_If_Web_Interface_
156168 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
157169
158170 mockSteamWebRequest . Setup ( x => x . GetAsync < OwnedGamesResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
159- . ReturnsAsync ( ( OwnedGamesResultContainer ) null ) ;
171+ . ReturnsAsync ( ( ISteamWebResponse < OwnedGamesResultContainer > ) null ) ;
160172
161173 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
162174 var result = await service . GetOwnedGamesAsync ( It . IsAny < ulong > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < IReadOnlyCollection < uint > > ( ) ) ;
@@ -165,20 +177,23 @@ public async Task PlayerService_GetOwnedGamesAsync_Return_Null_If_Web_Interface_
165177 }
166178
167179 [ TestMethod ]
168- public async Task PlayerService_GetOwnedGamesAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
180+ public async Task PlayerService_GetOwnedGamesAsync_Return_Null_Data_If_Web_Interface_Result_Is_Null ( )
169181 {
170182 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
171183
172184 mockSteamWebRequest . Setup ( x => x . GetAsync < OwnedGamesResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
173- . ReturnsAsync ( new OwnedGamesResultContainer ( )
185+ . ReturnsAsync ( new SteamWebResponse < OwnedGamesResultContainer > ( )
174186 {
175- Result = null
187+ Data = new OwnedGamesResultContainer ( )
188+ {
189+ Result = null
190+ }
176191 } ) ;
177192
178193 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
179194 var result = await service . GetOwnedGamesAsync ( It . IsAny < ulong > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < IReadOnlyCollection < uint > > ( ) ) ;
180195
181- Assert . IsNull ( result ) ;
196+ Assert . IsNull ( result . Data ) ;
182197 }
183198
184199 [ TestMethod ]
@@ -187,27 +202,30 @@ public async Task PlayerService_GetOwnedGamesAsync_Trim_Starting_And_Ending_Spac
187202 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
188203
189204 mockSteamWebRequest . Setup ( x => x . GetAsync < OwnedGamesResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
190- . ReturnsAsync ( new OwnedGamesResultContainer ( )
205+ . ReturnsAsync ( new SteamWebResponse < OwnedGamesResultContainer > ( )
191206 {
192- Result = new OwnedGamesResult ( )
207+ Data = new OwnedGamesResultContainer ( )
193208 {
194- GameCount = 10 ,
195- OwnedGames = new List < OwnedGame > ( )
209+ Result = new OwnedGamesResult ( )
210+ {
211+ GameCount = 10 ,
212+ OwnedGames = new List < OwnedGame > ( )
196213 {
197214 new OwnedGame ( ) { Name = " Test Game 1 " } ,
198215 new OwnedGame ( ) { Name = " Test Game 2 " } ,
199216 new OwnedGame ( ) { Name = " Test Game 3 " } ,
200217 new OwnedGame ( ) { Name = " Test Game 4 " } ,
201218 new OwnedGame ( ) { Name = " Test Game 5 " } ,
202219 }
220+ }
203221 }
204222 } ) ;
205223
206224 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
207225 var result = await service . GetOwnedGamesAsync ( It . IsAny < ulong > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < bool ? > ( ) , It . IsAny < IReadOnlyCollection < uint > > ( ) ) ;
208226
209227 // Make sure all game names have been trimmed on the edges
210- foreach ( var game in result . OwnedGames )
228+ foreach ( var game in result . Data . OwnedGames )
211229 {
212230 Assert . IsTrue ( ! game . Name . StartsWith ( " " ) ) ;
213231 Assert . IsTrue ( ! game . Name . EndsWith ( " " ) ) ;
@@ -220,7 +238,7 @@ public async Task PlayerService_GetRecentlyPlayedGamesAsync_Return_Null_If_Web_I
220238 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
221239
222240 mockSteamWebRequest . Setup ( x => x . GetAsync < RecentlyPlayedGameResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
223- . ReturnsAsync ( ( RecentlyPlayedGameResultContainer ) null ) ;
241+ . ReturnsAsync ( ( ISteamWebResponse < RecentlyPlayedGameResultContainer > ) null ) ;
224242
225243 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
226244 var result = await service . GetRecentlyPlayedGamesAsync ( It . IsAny < ulong > ( ) ) ;
@@ -229,20 +247,23 @@ public async Task PlayerService_GetRecentlyPlayedGamesAsync_Return_Null_If_Web_I
229247 }
230248
231249 [ TestMethod ]
232- public async Task PlayerService_GetRecentlyPlayedGamesAsync_Return_Null_If_Web_Interface_Result_Is_Null ( )
250+ public async Task PlayerService_GetRecentlyPlayedGamesAsync_Return_Null_Data_If_Web_Interface_Result_Is_Null ( )
233251 {
234252 var mockSteamWebRequest = new Mock < ISteamWebInterface > ( ) ;
235253
236254 mockSteamWebRequest . Setup ( x => x . GetAsync < RecentlyPlayedGameResultContainer > ( It . IsAny < string > ( ) , It . IsAny < int > ( ) , It . IsAny < IList < SteamWebRequestParameter > > ( ) ) )
237- . ReturnsAsync ( new RecentlyPlayedGameResultContainer ( )
255+ . ReturnsAsync ( new SteamWebResponse < RecentlyPlayedGameResultContainer > ( )
238256 {
239- Result = null
257+ Data = new RecentlyPlayedGameResultContainer ( )
258+ {
259+ Result = null
260+ }
240261 } ) ;
241262
242263 var service = new PlayerService ( String . Empty , mockSteamWebRequest . Object ) ;
243264 var result = await service . GetRecentlyPlayedGamesAsync ( It . IsAny < ulong > ( ) ) ;
244265
245- Assert . IsNull ( result ) ;
266+ Assert . IsNull ( result . Data ) ;
246267 }
247268 }
248269}
0 commit comments