File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Test/Notion.IntegrationTests Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -244,5 +244,59 @@ public async Task Test_UpdatePageProperty_with_date_as_null()
244244 //cleanup
245245 await _client . Blocks . DeleteAsync ( page . Id ) ;
246246 }
247+
248+ [ Fact ]
249+ public async Task Bug_Unable_To_Parse_NumberPropertyItem ( )
250+ {
251+ // Arrange
252+ var pagesCreateParameters = PagesCreateParametersBuilder . Create ( new DatabaseParentInput
253+ {
254+ DatabaseId = _databaseId
255+ } ) . AddProperty ( "Name" , new TitlePropertyValue
256+ {
257+ Title = new List < RichTextBase >
258+ {
259+ new RichTextText
260+ {
261+ Text = new Text
262+ {
263+ Content = "Test Page Title"
264+ }
265+ }
266+ }
267+ } ) . AddProperty ( "Number" , new NumberPropertyValue
268+ {
269+ Number = 200.00
270+ } ) . Build ( ) ;
271+
272+ // Act
273+ var page = await _client . Pages . CreateAsync ( pagesCreateParameters ) ;
274+
275+ // Assert
276+ Assert . NotNull ( page ) ;
277+ var pageParent = Assert . IsType < DatabaseParent > ( page . Parent ) ;
278+ Assert . Equal ( _databaseId , pageParent . DatabaseId ) ;
279+
280+ var titleProperty = ( ListPropertyItem ) await _client . Pages . RetrievePagePropertyItem ( new RetrievePropertyItemParameters
281+ {
282+ PageId = page . Id ,
283+ PropertyId = page . Properties [ "Name" ] . Id
284+ } ) ;
285+
286+ Assert . Equal ( "Test Page Title" , titleProperty . Results . First ( ) . As < TitlePropertyItem > ( ) . Title . PlainText ) ;
287+
288+ var numberProperty = ( NumberPropertyItem ) await _client . Pages . RetrievePagePropertyItem ( new RetrievePropertyItemParameters
289+ {
290+ PageId = page . Id ,
291+ PropertyId = page . Properties [ "Number" ] . Id
292+ } ) ;
293+
294+ Assert . Equal ( 200.00 , numberProperty . Number ) ;
295+
296+ await _client . Pages . UpdateAsync ( page . Id , new PagesUpdateParameters
297+ {
298+ Archived = true
299+ } ) ;
300+ }
247301 }
248302}
You can’t perform that action at this time.
0 commit comments