1414using Microsoft . Test . E2E . AspNet . OData . Common . Execution ;
1515using Microsoft . Test . E2E . AspNet . OData . Common . Extensions ;
1616using Microsoft . Test . E2E . AspNet . OData . Common . Instancing ;
17- using Microsoft . Test . E2E . AspNet . OData . Common . Models . Vehicle ;
1817using Nop . Core . Domain . Blogs ;
1918using Xunit ;
2019
@@ -60,7 +59,19 @@ public void ThrowExceptionInAction()
6059 }
6160 }
6261
63- public class MixScenarioTests_ODataController : InMemoryODataController < Vehicle , int >
62+ [ Key ( "Id" ) ]
63+ public class MixVehicle
64+ {
65+ public int Id { get ; set ; }
66+
67+ public string Model { get ; set ; }
68+
69+ public string Name { get ; set ; }
70+
71+ public virtual int WheelCount { get ; set ; }
72+ }
73+
74+ public class MixScenarioTests_ODataController : InMemoryODataController < MixVehicle , int >
6475 {
6576 public MixScenarioTests_ODataController ( )
6677 : base ( "Id" )
@@ -85,7 +96,7 @@ protected override void UpdateConfiguration(WebRouteConfiguration configuration)
8596 protected static IEdmModel GetEdmModel ( WebRouteConfiguration configuration )
8697 {
8798 var mb = configuration . CreateConventionModelBuilder ( ) ;
88- mb . EntitySet < Vehicle > ( "MixScenarioTests_OData" ) ;
99+ mb . EntitySet < MixVehicle > ( "MixScenarioTests_OData" ) ;
89100 return mb . GetEdmModel ( ) ;
90101 }
91102
@@ -128,7 +139,7 @@ public MixScenarioTestsOData(WebHostTestFixture fixture)
128139 protected static IEdmModel GetEdmModel ( WebRouteConfiguration configuration )
129140 {
130141 var mb = configuration . CreateConventionModelBuilder ( ) ;
131- mb . EntitySet < Vehicle > ( "MixScenarioTests_OData" ) ;
142+ mb . EntitySet < MixVehicle > ( "MixScenarioTests_OData" ) ;
132143 return mb . GetEdmModel ( ) ;
133144 }
134145
@@ -143,7 +154,7 @@ public async Task ODataCRUDShouldWorkAsync()
143154 await this . ClearRepositoryAsync ( entitySetName ) ;
144155
145156 // post new entity to repository
146- var baseline = InstanceCreator . CreateInstanceOf < Vehicle > ( rand ) ;
157+ var baseline = InstanceCreator . CreateInstanceOf < MixVehicle > ( rand ) ;
147158 await PostNewEntityAsync ( uri , baseline , entitySetName ) ;
148159
149160 // get collection of entities from repository
@@ -178,23 +189,23 @@ await UpdateEntityAsync(
178189 Assert . Null ( thirdVersion ) ;
179190 }
180191
181- private async Task < DataServiceResponse > PostNewEntityAsync ( Uri baseAddress , Vehicle entity , string entitySetName )
192+ private async Task < DataServiceResponse > PostNewEntityAsync ( Uri baseAddress , MixVehicle entity , string entitySetName )
182193 {
183194 var context = WriterClient ( baseAddress , ODataProtocolVersion . V4 ) ;
184195 context . AddObject ( entitySetName , entity ) ;
185196
186197 return await context . SaveChangesAsync ( ) ;
187198 }
188199
189- private async Task < IEnumerable < Vehicle > > GetEntitiesAsync ( Uri baseAddress , string entitySetName )
200+ private async Task < IEnumerable < MixVehicle > > GetEntitiesAsync ( Uri baseAddress , string entitySetName )
190201 {
191202 var context = ReaderClient ( baseAddress , ODataProtocolVersion . V4 ) ;
192- var query = context . CreateQuery < Vehicle > ( entitySetName ) ;
203+ var query = context . CreateQuery < MixVehicle > ( entitySetName ) ;
193204
194205 return await query . ExecuteAsync ( ) ;
195206 }
196207
197- private async Task < DataServiceResponse > UpdateEntityAsync ( Uri baseAddress , Vehicle from , Func < Vehicle , Vehicle > update , string entitySetName )
208+ private async Task < DataServiceResponse > UpdateEntityAsync ( Uri baseAddress , MixVehicle from , Func < MixVehicle , MixVehicle > update , string entitySetName )
198209 {
199210 var context = WriterClient ( baseAddress , ODataProtocolVersion . V4 ) ;
200211
@@ -205,7 +216,7 @@ private async Task<DataServiceResponse> UpdateEntityAsync(Uri baseAddress, Vehic
205216 return await context . SaveChangesAsync ( ) ;
206217 }
207218
208- private async Task < DataServiceResponse > DeleteEntityAsync ( Uri baseAddress , Vehicle entity , string entitySetName )
219+ private async Task < DataServiceResponse > DeleteEntityAsync ( Uri baseAddress , MixVehicle entity , string entitySetName )
209220 {
210221 var context = WriterClient ( baseAddress , ODataProtocolVersion . V4 ) ;
211222 context . AttachTo ( entitySetName , entity ) ;
0 commit comments