@@ -87,29 +87,27 @@ public void GetPathsDoesntReturnPathsForCountWhenDisabled()
8787 Assert . NotNull ( paths ) ;
8888 Assert . Equal ( 3 , paths . Count ( ) ) ;
8989 }
90-
91- [ Theory ]
92- [ InlineData ( "" , false , true , 3 ) ]
93- [ InlineData ( "" , false , false , 4 ) ]
94- [ InlineData ( @"
95- <Annotation Term=""Org.OData.Validation.V1.DerivedTypeConstraint"">
96- <Collection>
97- <String>NS.Customer</String>
98- <String>NS.NiceCustomer</String>
99- </Collection>
100- </Annotation>" , false , true , 6 ) ]
101- [ InlineData ( "" , true , false , 5 ) ]
102- [ InlineData ( "" , true , true , 4 ) ]
103- [ InlineData ( @"
90+ private const string derivedTypeAnnotation = @"
10491<Annotation Term=""Org.OData.Validation.V1.DerivedTypeConstraint"">
10592<Collection>
10693 <String>NS.Customer</String>
10794 <String>NS.NiceCustomer</String>
10895</Collection>
109- </Annotation>" , true , true , 5 ) ]
110- public void GetOperationPathsForModelWithDerivedTypesConstraint ( string annotation , bool getNavPropModel , bool requireConstraint , int expectedCount )
96+ </Annotation>" ;
97+
98+ [ Theory ]
99+ [ InlineData ( false , false , true , 3 ) ]
100+ [ InlineData ( false , false , false , 4 ) ]
101+ [ InlineData ( true , false , true , 6 ) ]
102+ [ InlineData ( true , false , false , 6 ) ]
103+ [ InlineData ( false , true , false , 5 ) ]
104+ [ InlineData ( false , true , true , 4 ) ]
105+ [ InlineData ( true , true , true , 5 ) ]
106+ [ InlineData ( true , true , false , 5 ) ]
107+ public void GetOperationPathsForModelWithDerivedTypesConstraint ( bool addAnnotation , bool getNavPropModel , bool requireConstraint , int expectedCount )
111108 {
112109 // Arrange
110+ var annotation = addAnnotation ? derivedTypeAnnotation : string . Empty ;
113111 IEdmModel model = getNavPropModel ? GetNavPropModel ( annotation ) : GetInheritanceModel ( annotation ) ;
114112 ODataPathProvider provider = new ( ) ;
115113 var settings = new OpenApiConvertSettings
@@ -120,6 +118,33 @@ public void GetOperationPathsForModelWithDerivedTypesConstraint(string annotatio
120118 // Act
121119 var paths = provider . GetPaths ( model , settings ) ;
122120
121+ // Assert
122+ Assert . NotNull ( paths ) ;
123+ Assert . Equal ( expectedCount , paths . Count ( ) ) ;
124+ }
125+ [ Theory ]
126+ [ InlineData ( false , false , true , 4 ) ]
127+ [ InlineData ( false , false , false , 6 ) ]
128+ [ InlineData ( true , false , true , 6 ) ]
129+ [ InlineData ( true , false , false , 6 ) ]
130+ [ InlineData ( false , true , false , 5 ) ]
131+ [ InlineData ( false , true , true , 5 ) ]
132+ [ InlineData ( true , true , true , 5 ) ]
133+ [ InlineData ( true , true , false , 5 ) ]
134+ public void GetTypeCastPathsForModelWithDerivedTypesConstraint ( bool addAnnotation , bool getNavPropModel , bool requireConstraint , int expectedCount )
135+ {
136+ // Arrange
137+ var annotation = addAnnotation ? derivedTypeAnnotation : string . Empty ;
138+ IEdmModel model = getNavPropModel ? GetNavPropModel ( annotation ) : GetInheritanceModel ( annotation ) ;
139+ ODataPathProvider provider = new ( ) ;
140+ var settings = new OpenApiConvertSettings
141+ {
142+ RequireDerivedTypesConstraintForODataTypeCastSegments = requireConstraint
143+ } ;
144+
145+ // Act
146+ var paths = provider . GetPaths ( model , settings ) ;
147+
123148 // Assert
124149 Assert . NotNull ( paths ) ;
125150 Assert . Equal ( expectedCount , paths . Count ( ) ) ;
0 commit comments