File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Source/Clients/AspNetCore.Specs/Rules/for_RulesModelValidatorProvider/given Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
44using Cratis . Chronicle . Rules ;
5+ using Microsoft . AspNetCore . Http ;
56
67namespace Cratis . Chronicle . AspNetCore . Rules . for_RulesModelValidatorProvider . given ;
78
@@ -10,12 +11,20 @@ public class one_rule_for_type : Specification
1011 protected RulesModelValidatorProvider _provider ;
1112 protected IRules _rules ;
1213 protected IServiceProvider _serviceProvider ;
14+ protected IServiceProvider _scopedServiceProvider ;
15+ protected IHttpContextAccessor _httpContextAccessor ;
1316
1417 void Establish ( )
1518 {
1619 _rules = Substitute . For < IRules > ( ) ;
1720 _serviceProvider = Substitute . For < IServiceProvider > ( ) ;
18- _serviceProvider . GetService ( typeof ( IRules ) ) . Returns ( _rules ) ;
21+ _httpContextAccessor = Substitute . For < IHttpContextAccessor > ( ) ;
22+ _serviceProvider . GetService ( typeof ( IHttpContextAccessor ) ) . Returns ( _httpContextAccessor ) ;
23+ var httpContext = Substitute . For < HttpContext > ( ) ;
24+ _httpContextAccessor . HttpContext . Returns ( httpContext ) ;
25+ _scopedServiceProvider = Substitute . For < IServiceProvider > ( ) ;
26+ httpContext . RequestServices . Returns ( _scopedServiceProvider ) ;
27+ _scopedServiceProvider . GetService ( typeof ( IRules ) ) . Returns ( _rules ) ;
1928 _provider = new ( _serviceProvider ) ;
2029 }
2130}
You can’t perform that action at this time.
0 commit comments