@@ -10,27 +10,27 @@ public class GetItemAsyncTests : TestBase
1010 public async Task GetItemAsync_WithValidId_ReturnsItem ( )
1111 {
1212 // First get a valid item ID from search
13- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
13+ var searchResult = await Client . SearchAsync ( new SearchOptions
1414 {
1515 Query = "technology" ,
16- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
16+ PageOptions = new PageOptions { PageSize = 1 }
1717 } ) ;
18- searchResult . ShouldNotBeNull ( "Search should return results" ) ;
19- searchResult . Results . Count . ShouldBe ( 1 , "Should return exactly one result" ) ;
18+ searchResult . ShouldNotBeNull ( ) ;
19+ searchResult . Results . Count . ShouldBe ( 1 ) ;
2020
2121 var contentItem = searchResult . Results . First ( ) ;
2222 var itemId = contentItem . Id ;
2323
2424 // Now get the specific item
25- var singleItemResult = await ApiClient . GetItemAsync ( itemId ,
26- new GuardianApiContentAdditionalInformationOptions { ShowFields = [ GuardianApiContentShowFieldsOption . Body ] } ) ;
25+ var singleItemResult = await Client . GetItemAsync ( itemId ,
26+ new AdditionalInformationOptions { ShowFields = [ ContentField . Body ] } ) ;
2727
28- singleItemResult . ShouldNotBeNull ( "GetItem result should not be null" ) ;
29- singleItemResult . Status . ShouldBe ( "ok" , "API response status should be 'ok'" ) ;
30- singleItemResult . Content . ShouldNotBeNull ( "Content should not be null" ) ;
31- singleItemResult . Content . Id . ShouldBe ( itemId , "Returned content ID should match requested ID" ) ;
32- singleItemResult . Content . WebTitle . ShouldNotBeNullOrEmpty ( "Content should have a title" ) ;
33- singleItemResult . Content . Fields . ShouldNotBeNull ( "Fields should be populated when ShowFields is specified" ) ;
28+ singleItemResult . ShouldNotBeNull ( ) ;
29+ singleItemResult . Status . ShouldBe ( "ok" ) ;
30+ singleItemResult . Content . ShouldNotBeNull ( ) ;
31+ singleItemResult . Content . Id . ShouldBe ( itemId ) ;
32+ singleItemResult . Content . WebTitle . ShouldNotBeNullOrEmpty ( ) ;
33+ singleItemResult . Content . Fields . ShouldNotBeNull ( ) ;
3434
3535 Console . WriteLine ( $ "Retrieved item: { singleItemResult . Content . WebTitle } ") ;
3636 Console . WriteLine ( $ "Item ID: { singleItemResult . Content . Id } ") ;
@@ -51,7 +51,7 @@ public async Task GetItemAsync_WithInvalidId_ThrowsException()
5151
5252 var exception = await Should . ThrowAsync < HttpRequestException > ( async ( ) =>
5353 {
54- await ApiClient . GetItemAsync ( invalidId ) ;
54+ await Client . GetItemAsync ( invalidId ) ;
5555 } ) ;
5656
5757 Console . WriteLine ( $ "Expected exception for invalid ID: { exception . Message } ") ;
@@ -62,7 +62,7 @@ public async Task GetItemAsync_WithNullId_ThrowsArgumentException()
6262 {
6363 var exception = await Should . ThrowAsync < ArgumentException > ( async ( ) =>
6464 {
65- await ApiClient . GetItemAsync ( null ! ) ;
65+ await Client . GetItemAsync ( null ! ) ;
6666 } ) ;
6767
6868 Console . WriteLine ( $ "Expected exception for null ID: { exception . Message } ") ;
@@ -73,7 +73,7 @@ public async Task GetItemAsync_WithEmptyId_ThrowsArgumentException()
7373 {
7474 var exception = await Should . ThrowAsync < ArgumentException > ( async ( ) =>
7575 {
76- await ApiClient . GetItemAsync ( "" ) ;
76+ await Client . GetItemAsync ( "" ) ;
7777 } ) ;
7878
7979 Console . WriteLine ( $ "Expected exception for empty ID: { exception . Message } ") ;
@@ -83,30 +83,30 @@ public async Task GetItemAsync_WithEmptyId_ThrowsArgumentException()
8383 public async Task GetItemAsync_WithShowFields_ReturnsEnhancedContent ( )
8484 {
8585 // Get a valid item ID
86- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
86+ var searchResult = await Client . SearchAsync ( new SearchOptions
8787 {
8888 Query = "politics" ,
89- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
89+ PageOptions = new PageOptions { PageSize = 1 }
9090 } ) ;
9191
9292 var itemId = searchResult . Results . First ( ) . Id ;
9393
9494 // Request with multiple fields
95- var result = await ApiClient . GetItemAsync ( itemId ,
96- new GuardianApiContentAdditionalInformationOptions
95+ var result = await Client . GetItemAsync ( itemId ,
96+ new AdditionalInformationOptions
9797 {
9898 ShowFields =
9999 [
100- GuardianApiContentShowFieldsOption . Headline ,
101- GuardianApiContentShowFieldsOption . Body ,
102- GuardianApiContentShowFieldsOption . Byline ,
103- GuardianApiContentShowFieldsOption . Thumbnail
100+ ContentField . Headline ,
101+ ContentField . Body ,
102+ ContentField . Byline ,
103+ ContentField . Thumbnail
104104 ]
105105 } ) ;
106106
107107 result . ShouldNotBeNull ( ) ;
108- result . Content . Fields . ShouldNotBeNull ( "Fields should be populated" ) ;
109- result . Content . Fields . Headline . ShouldNotBeNullOrEmpty ( "Headline should be populated" ) ;
108+ result . Content . Fields . ShouldNotBeNull ( ) ;
109+ result . Content . Fields . Headline . ShouldNotBeNullOrEmpty ( ) ;
110110
111111 Console . WriteLine ( $ "Enhanced content for: { result . Content . WebTitle } ") ;
112112 Console . WriteLine ( $ "Headline: { result . Content . Fields . Headline } ") ;
@@ -118,24 +118,24 @@ public async Task GetItemAsync_WithShowFields_ReturnsEnhancedContent()
118118 public async Task GetItemAsync_WithShowTags_ReturnsContentWithTags ( )
119119 {
120120 // Get a valid item ID
121- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
121+ var searchResult = await Client . SearchAsync ( new SearchOptions
122122 {
123123 Query = "sport" ,
124- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
124+ PageOptions = new PageOptions { PageSize = 1 }
125125 } ) ;
126126
127127 var itemId = searchResult . Results . First ( ) . Id ;
128128
129129 // Request with tags
130- var result = await ApiClient . GetItemAsync ( itemId ,
131- new GuardianApiContentAdditionalInformationOptions
130+ var result = await Client . GetItemAsync ( itemId ,
131+ new AdditionalInformationOptions
132132 {
133- ShowTags = [ GuardianApiContentShowTagsOption . Keyword , GuardianApiContentShowTagsOption . Tone , GuardianApiContentShowTagsOption . Type ]
133+ ShowTags = [ ContentTag . Keyword , ContentTag . Tone , ContentTag . Type ]
134134 } ) ;
135135
136136 result . ShouldNotBeNull ( ) ;
137- result . Content . Tags . ShouldNotBeNull ( "Tags should be populated" ) ;
138- result . Content . Tags . Count . ShouldBeGreaterThan ( 0 , "Should have at least one tag" ) ;
137+ result . Content . Tags . ShouldNotBeNull ( ) ;
138+ result . Content . Tags . Count . ShouldBeGreaterThan ( 0 ) ;
139139
140140 Console . WriteLine ( $ "Content '{ result . Content . WebTitle } ' has { result . Content . Tags . Count } tags:") ;
141141 foreach ( var tag in result . Content . Tags . Take ( 5 ) ) // Show first 5 tags
@@ -148,19 +148,19 @@ public async Task GetItemAsync_WithShowTags_ReturnsContentWithTags()
148148 public async Task GetItemAsync_WithShowElements_ReturnsContentWithElements ( )
149149 {
150150 // Get a valid item ID
151- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
151+ var searchResult = await Client . SearchAsync ( new SearchOptions
152152 {
153153 Query = "music" ,
154- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
154+ PageOptions = new PageOptions { PageSize = 1 }
155155 } ) ;
156156
157157 var itemId = searchResult . Results . First ( ) . Id ;
158158
159159 // Request with elements
160- var result = await ApiClient . GetItemAsync ( itemId ,
161- new GuardianApiContentAdditionalInformationOptions
160+ var result = await Client . GetItemAsync ( itemId ,
161+ new AdditionalInformationOptions
162162 {
163- ShowElements = [ GuardianApiContentShowElementsOption . Image , GuardianApiContentShowElementsOption . Video ]
163+ ShowElements = [ ContentElement . Image , ContentElement . Video ]
164164 } ) ;
165165
166166 result . ShouldNotBeNull ( ) ;
@@ -181,17 +181,17 @@ public async Task GetItemAsync_WithShowElements_ReturnsContentWithElements()
181181 public async Task GetItemAsync_WithShowBlocks_ReturnsContentWithBlocks ( )
182182 {
183183 // Get a valid item ID
184- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
184+ var searchResult = await Client . SearchAsync ( new SearchOptions
185185 {
186186 Query = "news" ,
187- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
187+ PageOptions = new PageOptions { PageSize = 1 }
188188 } ) ;
189189
190190 var itemId = searchResult . Results . First ( ) . Id ;
191191
192192 // Request with blocks using string array (as it's still string-based)
193- var result = await ApiClient . GetItemAsync ( itemId ,
194- new GuardianApiContentAdditionalInformationOptions
193+ var result = await Client . GetItemAsync ( itemId ,
194+ new AdditionalInformationOptions
195195 {
196196 ShowBlocks = [ "main" , "body" ]
197197 } ) ;
@@ -214,27 +214,27 @@ public async Task GetItemAsync_WithShowBlocks_ReturnsContentWithBlocks()
214214 public async Task GetItemAsync_WithAllOptions_ReturnsFullyEnhancedContent ( )
215215 {
216216 // Get a valid item ID
217- var searchResult = await ApiClient . SearchAsync ( new GuardianApiContentSearchOptions
217+ var searchResult = await Client . SearchAsync ( new SearchOptions
218218 {
219219 Query = "culture" ,
220- PageOptions = new GuardianApiContentPageOptions { PageSize = 1 }
220+ PageOptions = new PageOptions { PageSize = 1 }
221221 } ) ;
222222
223223 var itemId = searchResult . Results . First ( ) . Id ;
224224
225225 // Request with all enhancement options
226- var result = await ApiClient . GetItemAsync ( itemId ,
227- new GuardianApiContentAdditionalInformationOptions
226+ var result = await Client . GetItemAsync ( itemId ,
227+ new AdditionalInformationOptions
228228 {
229- ShowFields = [ GuardianApiContentShowFieldsOption . All ] ,
230- ShowTags = [ GuardianApiContentShowTagsOption . All ] ,
231- ShowElements = [ GuardianApiContentShowElementsOption . All ] ,
229+ ShowFields = [ ContentField . All ] ,
230+ ShowTags = [ ContentTag . All ] ,
231+ ShowElements = [ ContentElement . All ] ,
232232 ShowBlocks = [ "all" ]
233233 } ) ;
234234
235235 result . ShouldNotBeNull ( ) ;
236- result . Content . Fields . ShouldNotBeNull ( "All fields should be populated" ) ;
237- result . Content . Tags . ShouldNotBeNull ( "All tags should be populated" ) ;
236+ result . Content . Fields . ShouldNotBeNull ( ) ;
237+ result . Content . Tags . ShouldNotBeNull ( ) ;
238238
239239 Console . WriteLine ( $ "Fully enhanced content: { result . Content . WebTitle } ") ;
240240 Console . WriteLine ( $ " Fields populated: Yes") ;
0 commit comments