Skip to content

Commit 01a84f9

Browse files
committed
Update tests to validate retrieving descriptions for complex properties
1 parent caa5516 commit 01a84f9

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyGetOperationHandlerTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void CreateComplexPropertyGetOperationReturnsCorrectOperationForSingle(bo
3737
// Assert
3838
Assert.NotNull(get);
3939
Assert.Equal("Get BillingAddress property value", get.Summary);
40+
Assert.Equal("Get the BillingAddress.", get.Description);
4041

4142
Assert.NotNull(get.Parameters);
4243
Assert.Equal(3, get.Parameters.Count); //id, select, expand
@@ -77,6 +78,7 @@ public void CreateComplexPropertyGetOperationReturnsCorrectOperationForCollectio
7778
// Assert
7879
Assert.NotNull(get);
7980
Assert.Equal("Get AlternativeAddresses property value", get.Summary);
81+
Assert.Equal("The AlternativeAddresses.", get.Description);
8082

8183
Assert.NotNull(get.Parameters);
8284
Assert.Equal(9, get.Parameters.Count); //id, select, expand, order, top, skip, count, search, filter

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPatchOperationHandlerTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void CreateComplexPropertyDeleteOperationReturnsCorrectOperationForSingle
3737
// Assert
3838
Assert.NotNull(patch);
3939
Assert.Equal("Update property BillingAddress value.", patch.Summary);
40+
Assert.Equal("Update the BillingAddress.", patch.Description);
4041

4142
Assert.NotNull(patch.Parameters);
4243
Assert.Equal(1, patch.Parameters.Count); //id
@@ -77,6 +78,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti
7778
// Assert
7879
Assert.NotNull(patch);
7980
Assert.Equal("Update property AlternativeAddresses value.", patch.Summary);
81+
Assert.Null(patch.Description);
8082

8183
Assert.NotNull(patch.Parameters);
8284
Assert.Equal(1, patch.Parameters.Count); //id

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/ComplexPropertyPostOperationHandlerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void CreateComplexPropertyPostOperationReturnsCorrectOperationForCollecti
5252
// Assert
5353
Assert.NotNull(post);
5454
Assert.Equal("Sets a new value for the collection of Address.", post.Summary);
55+
Assert.Equal("Create a new AlternativeAddress.", post.Description);
5556

5657
Assert.NotNull(post.Parameters);
5758
Assert.Equal(2, post.Parameters.Count); //id, etag

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetGetOperationHandlerTests.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,22 @@ public static IEdmModel GetEdmModel(string annotation)
336336
<PropertyRef Name=""ID"" />
337337
</Key>
338338
<Property Name=""ID"" Type=""Edm.Int32"" Nullable=""false"" />
339-
<Property Name=""BillingAddress"" Type=""NS.Address"" />
339+
<Property Name=""BillingAddress"" Type=""NS.Address"">
340+
<Annotation Term=""Org.OData.Capabilities.V1.ReadRestrictions"">
341+
<Record>
342+
<PropertyValue Property=""Description"" String=""Get the BillingAddress."" />
343+
</Record>
344+
</Annotation>
345+
<Annotation Term=""Org.OData.Capabilities.V1.UpdateRestrictions"">
346+
<Record>
347+
<PropertyValue Property=""Description"" String=""Update the BillingAddress."" />
348+
</Record>
349+
</Annotation>
350+
</Property>
340351
<Property Name=""MailingAddress"" Type=""NS.Address"" Nullable=""false"" />
341-
<Property Name=""AlternativeAddresses"" Type=""Collection(NS.Address)"" Nullable=""false"" />
352+
<Property Name=""AlternativeAddresses"" Type=""Collection(NS.Address)"" Nullable=""false"">
353+
<Annotation Term=""Org.OData.Core.V1.Description"" String=""The AlternativeAddresses."" />
354+
</Property>
342355
</EntityType>
343356
<EntityContainer Name =""Default"">
344357
<EntitySet Name=""Customers"" EntityType=""NS.Customer"">

test/Microsoft.OpenAPI.OData.Reader.Tests/Operation/EntitySetPostOperationHandlerTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,13 @@ internal static IEdmModel GetEdmModel(string annotation, bool hasStream = false)
244244
<Property Name=""ID"" Type=""Edm.Int32"" Nullable=""false"" />
245245
<Property Name=""BillingAddress"" Type=""NS.Address"" />
246246
<Property Name=""MailingAddress"" Type=""NS.Address"" Nullable=""false"" />
247-
<Property Name=""AlternativeAddresses"" Type=""Collection(NS.Address)"" Nullable=""false"" />
247+
<Property Name=""AlternativeAddresses"" Type=""Collection(NS.Address)"" Nullable=""false"">
248+
<Annotation Term=""Org.OData.Capabilities.V1.InsertRestrictions"">
249+
<Record>
250+
<PropertyValue Property=""Description"" String=""Create a new AlternativeAddress."" />
251+
</Record>
252+
</Annotation>
253+
</Property>
248254
</EntityType>
249255
<EntityContainer Name =""Default"">
250256
<EntitySet Name=""Customers"" EntityType=""NS.Customer"">

0 commit comments

Comments
 (0)