File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 77 </PropertyGroup >
88
99 <ItemGroup >
10+ <PackageReference Include =" FluentAssertions" Version =" 5.10.3" />
1011 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.7.1" />
1112 <PackageReference Include =" Microsoft.VisualStudio.VsixColorCompiler" Version =" 16.0.0" />
1213 <PackageReference Include =" WireMock.Net" Version =" 1.4.19" />
Original file line number Diff line number Diff line change 11using System . IO ;
22using System . Threading . Tasks ;
3+ using FluentAssertions ;
34using Notion . Client ;
45using WireMock . ResponseBuilders ;
56using Xunit ;
@@ -15,6 +16,30 @@ public PagesClientTests()
1516 _client = new PagesClient ( new RestClient ( ClientOptions ) ) ;
1617 }
1718
19+ [ Fact ]
20+ public async Task RetrieveAsync ( )
21+ {
22+ var pageId = "251d2b5f-268c-4de2-afe9-c71ff92ca95c" ;
23+ var path = ApiEndpoints . PagesApiUrls . Retrieve ( pageId ) ;
24+ var jsonData = await File . ReadAllTextAsync ( "data/pages/PageObjectShouldHaveUrlPropertyResponse.json" ) ;
25+
26+ Server . Given ( CreateGetRequestBuilder ( path ) )
27+ . RespondWith (
28+ Response . Create ( )
29+ . WithStatusCode ( 200 )
30+ . WithBody ( jsonData )
31+ ) ;
32+
33+ var page = await _client . RetrieveAsync ( pageId ) ;
34+
35+ page . Url . Should ( ) . Be ( "https://www.notion.so/Avocado-251d2b5f268c4de2afe9c71ff92ca95c" ) ;
36+ page . Id . Should ( ) . Be ( pageId ) ;
37+ page . Parent . Type . Should ( ) . Be ( ParentType . DatabaseId ) ;
38+ ( ( DatabaseParent ) page . Parent ) . DatabaseId . Should ( ) . Be ( "48f8fee9-cd79-4180-bc2f-ec0398253067" ) ;
39+ page . IsArchived . Should ( ) . BeFalse ( ) ;
40+
41+ }
42+
1843 [ Fact ]
1944 public async Task PageObjectShouldHaveUrlProperty ( )
2045 {
@@ -31,7 +56,8 @@ public async Task PageObjectShouldHaveUrlProperty()
3156
3257 var page = await _client . RetrieveAsync ( pageId ) ;
3358
34- Assert . Equal ( "https://www.notion.so/Avocado-251d2b5f268c4de2afe9c71ff92ca95c" , page . Url ) ;
59+ page . Url . Should ( ) . Be ( "https://www.notion.so/Avocado-251d2b5f268c4de2afe9c71ff92ca95c" ) ;
60+
3561 }
3662 }
3763}
You can’t perform that action at this time.
0 commit comments