File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change @@ -86,5 +86,49 @@ public async Task RetrieveAsync()
8686 todoBlock . ToDo . Text . First ( ) . Should ( ) . BeAssignableTo < RichTextText > ( ) ;
8787 ( ( RichTextText ) todoBlock . ToDo . Text . First ( ) ) . Text . Content . Should ( ) . Be ( "Lacinato kale" ) ;
8888 }
89+
90+ [ Fact ]
91+ public async Task UpdateAsync ( )
92+ {
93+ string blockId = "9bc30ad4-9373-46a5-84ab-0a7845ee52e6" ;
94+ var path = ApiEndpoints . BlocksApiUrls . Update ( blockId ) ;
95+ var jsonData = await File . ReadAllTextAsync ( "data/blocks/UpdateBlockResponse.json" ) ;
96+
97+ Server . Given ( CreatePatchRequestBuilder ( path ) )
98+ . RespondWith (
99+ Response . Create ( )
100+ . WithStatusCode ( 200 )
101+ . WithBody ( jsonData )
102+ ) ;
103+
104+ var updateBlock = new ToDoUpdateBlock
105+ {
106+ ToDo = new ToDoUpdateBlock . Info
107+ {
108+ Text = new List < RichTextBaseInput > ( )
109+ {
110+ new RichTextTextInput
111+ {
112+ Text = new Text
113+ {
114+ Content = "Lacinato kale"
115+ } ,
116+ }
117+ } ,
118+ IsChecked = true
119+ }
120+ } ;
121+
122+ var block = await _client . UpdateAsync ( blockId , updateBlock ) ;
123+
124+ block . Id . Should ( ) . Be ( blockId ) ;
125+ block . HasChildren . Should ( ) . BeFalse ( ) ;
126+ block . Type . Should ( ) . Be ( BlockType . ToDo ) ;
127+
128+ var todoBlock = ( ( ToDoBlock ) block ) ;
129+ todoBlock . ToDo . Text . Should ( ) . ContainSingle ( ) ;
130+ todoBlock . ToDo . Text . First ( ) . Should ( ) . BeAssignableTo < RichTextText > ( ) ;
131+ ( ( RichTextText ) todoBlock . ToDo . Text . First ( ) ) . Text . Content . Should ( ) . Be ( "Lacinato kale" ) ;
132+ }
89133 }
90134}
Original file line number Diff line number Diff line change 3030 <None Update =" data\blocks\RetrieveBlockResponse.json" >
3131 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
3232 </None >
33+ <None Update =" data\blocks\UpdateBlockResponse.json" >
34+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
35+ </None >
3336 <None Update =" data\databases\CreateDatabaseResponse.json" >
3437 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
3538 </None >
Original file line number Diff line number Diff line change 1+ {
2+ "object" : " block" ,
3+ "id" : " 9bc30ad4-9373-46a5-84ab-0a7845ee52e6" ,
4+ "created_time" : " 2021-03-16T16:31:00.000Z" ,
5+ "last_edited_time" : " 2021-03-16T16:32:00.000Z" ,
6+ "has_children" : false ,
7+ "type" : " to_do" ,
8+ "to_do" : {
9+ "text" : [
10+ {
11+ "type" : " text" ,
12+ "text" : {
13+ "content" : " Lacinato kale" ,
14+ "link" : null
15+ },
16+ "annotations" : {
17+ "bold" : false ,
18+ "italic" : false ,
19+ "strikethrough" : false ,
20+ "underline" : false ,
21+ "code" : false ,
22+ "color" : " default"
23+ },
24+ "plain_text" : " Lacinato kale" ,
25+ "href" : null
26+ }
27+ ],
28+ "checked" : false
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments