@@ -56,12 +56,10 @@ public async Task CreateAsync()
5656 . WithBody ( jsonData )
5757 ) ;
5858
59- var newPage = new NewPage ( new PageParent
59+ var pagesCreateParameters = PagesCreateParametersBuilder . Create ( new DatabaseParentInput
6060 {
61- PageId = "3c357473-a281-49a4-88c0-10d2b245a589"
62- } ) ;
63-
64- newPage . AddProperty ( "Name" , new TitlePropertyValue ( )
61+ DatabaseId = "3c357473-a281-49a4-88c0-10d2b245a589"
62+ } ) . AddProperty ( "Name" , new TitlePropertyValue ( )
6563 {
6664 Title = new List < RichTextBase > ( )
6765 {
@@ -73,17 +71,17 @@ public async Task CreateAsync()
7371 }
7472 }
7573 }
76- } ) ;
74+ } ) . Build ( ) ;
7775
78- var page = await _client . CreateAsync ( newPage ) ;
76+ var page = await _client . CreateAsync ( pagesCreateParameters ) ;
7977
8078 page . Id . Should ( ) . NotBeNullOrEmpty ( ) ;
8179 page . Url . Should ( ) . NotBeNullOrEmpty ( ) ;
8280 page . Properties . Should ( ) . HaveCount ( 1 ) ;
8381 page . Properties . First ( ) . Key . Should ( ) . Be ( "Name" ) ;
8482 page . IsArchived . Should ( ) . BeFalse ( ) ;
8583 page . Parent . Should ( ) . NotBeNull ( ) ;
86- ( ( PageParent ) page . Parent ) . PageId . Should ( ) . Be ( "3c357473-a281-49a4-88c0-10d2b245a589" ) ;
84+ ( ( DatabaseParent ) page . Parent ) . DatabaseId . Should ( ) . Be ( "3c357473-a281-49a4-88c0-10d2b245a589" ) ;
8785 }
8886
8987 [ Fact ]
@@ -201,32 +199,35 @@ public async Task ArchivePageAsync()
201199 [ Fact ]
202200 public async Task CreateAsync_Throws_ArgumentNullException_When_Parameter_Is_Null ( )
203201 {
204- Func < Task > act = async ( ) => await _client . CreateAsync ( page : null ) ;
202+ Func < Task > act = async ( ) => await _client . CreateAsync ( null ) ;
205203
206- ( await act . Should ( ) . ThrowAsync < ArgumentNullException > ( ) ) . And . ParamName . Should ( ) . Be ( "page " ) ;
204+ ( await act . Should ( ) . ThrowAsync < ArgumentNullException > ( ) ) . And . ParamName . Should ( ) . Be ( "pagesCreateParameters " ) ;
207205 }
208206
209207 [ Fact ]
210208 public async Task CreateAsync_Throws_ArgumentNullException_When_Parent_Is_Missing ( )
211209 {
212- var newPage = new NewPage ( null ) ;
210+ var pagesCreateParameters = PagesCreateParametersBuilder . Create ( null ) . Build ( ) ;
213211
214- Func < Task > act = async ( ) => await _client . CreateAsync ( newPage ) ;
212+ Func < Task > act = async ( ) => await _client . CreateAsync ( pagesCreateParameters ) ;
215213
216214 ( await act . Should ( ) . ThrowAsync < ArgumentNullException > ( ) ) . And . ParamName . Should ( ) . Be ( "Parent" ) ;
217215 }
218216
219217 [ Fact ]
220218 public async Task CreateAsync_Throws_ArgumentNullException_When_Properties_Is_Missing ( )
221219 {
222- var newPage = new NewPage ( new PageParent ( )
220+ var pagesCreateParameters = new PagesCreateParameters
223221 {
224- PageId = "3c357473-a281-49a4-88c0-10d2b245a589"
225- } ) ;
222+ Parent = new ParentPageInput ( )
223+ {
224+ PageId = "3c357473-a281-49a4-88c0-10d2b245a589" ,
226225
227- newPage . Properties = null ;
226+ } ,
227+ Properties = null
228+ } ;
228229
229- Func < Task > act = async ( ) => await _client . CreateAsync ( newPage ) ;
230+ Func < Task > act = async ( ) => await _client . CreateAsync ( pagesCreateParameters ) ;
230231
231232 ( await act . Should ( ) . ThrowAsync < ArgumentNullException > ( ) ) . And . ParamName . Should ( ) . Be ( "Properties" ) ;
232233 }
0 commit comments