@@ -29,7 +29,7 @@ public async Task DisposeAsync()
29
29
public async Task QueryDatabase ( )
30
30
{
31
31
// Arrange
32
- var createdDatabase = await CreateDatabaseWithAPageAsync ( ) ;
32
+ var createdDatabase = await CreateDatabaseWithAPageAsync ( "Test List" ) ;
33
33
34
34
// Act
35
35
var response = await Client . Databases . QueryAsync ( createdDatabase . Id , new DatabasesQueryParameters ( ) ) ;
@@ -43,7 +43,64 @@ public async Task QueryDatabase()
43
43
. Text . Content . Should ( ) . Be ( "Test Title" ) ;
44
44
}
45
45
46
- private async Task < Database > CreateDatabaseWithAPageAsync ( )
46
+ [ Fact ]
47
+ public async Task UpdateDatabaseRelationProperties ( )
48
+ {
49
+ // Arrange
50
+ var createdSourceDatabase = await CreateDatabaseWithAPageAsync ( "Test Relation Source" ) ;
51
+ var createdDestinationDatabase = await CreateDatabaseWithAPageAsync ( "Test Relation Destination" ) ;
52
+
53
+ // Act
54
+ var response = await Client . Databases . UpdateAsync ( createdDestinationDatabase . Id ,
55
+ new DatabasesUpdateParameters
56
+ {
57
+ Properties = new Dictionary < string , IUpdatePropertySchema >
58
+ {
59
+ {
60
+ "Single Relation" ,
61
+ new RelationUpdatePropertySchema
62
+ {
63
+ Relation = new SinglePropertyRelation
64
+ {
65
+ DatabaseId = createdSourceDatabase . Id ,
66
+ SingleProperty = new Dictionary < string , object > ( )
67
+ }
68
+ }
69
+ } ,
70
+ {
71
+ "Dual Relation" ,
72
+ new RelationUpdatePropertySchema
73
+ {
74
+ Relation = new DualPropertyRelation
75
+ {
76
+ DatabaseId = createdSourceDatabase . Id ,
77
+ DualProperty = new DualPropertyRelation . Data ( )
78
+ }
79
+ }
80
+ }
81
+ }
82
+ } ) ;
83
+
84
+ // Assert
85
+ response . Properties . Should ( ) . NotBeNull ( ) ;
86
+
87
+ response . Properties . Should ( ) . ContainKey ( "Single Relation" ) ;
88
+ var singleRelation = response . Properties [ "Single Relation" ] . As < RelationProperty > ( ) . Relation ;
89
+ singleRelation . Should ( ) . BeEquivalentTo (
90
+ new SinglePropertyRelation
91
+ {
92
+ DatabaseId = createdSourceDatabase . Id ,
93
+ SingleProperty = new Dictionary < string , object > ( )
94
+ } ) ;
95
+
96
+ response . Properties . Should ( ) . ContainKey ( "Dual Relation" ) ;
97
+ var dualRelation = response . Properties [ "Dual Relation" ] . As < RelationProperty > ( ) . Relation ;
98
+ dualRelation . DatabaseId . Should ( ) . Be ( createdSourceDatabase . Id ) ;
99
+ dualRelation . Type . Should ( ) . Be ( RelationType . Dual ) ;
100
+ dualRelation . Should ( ) . BeOfType < DualPropertyRelation > ( ) ;
101
+ }
102
+
103
+ private async Task < Database > CreateDatabaseWithAPageAsync ( string databaseName )
47
104
{
48
105
var createDbRequest = new DatabasesCreateParameters
49
106
{
@@ -53,7 +110,7 @@ private async Task<Database> CreateDatabaseWithAPageAsync()
53
110
{
54
111
Text = new Text
55
112
{
56
- Content = "Test List" ,
113
+ Content = databaseName ,
57
114
Link = null
58
115
}
59
116
}
0 commit comments