@@ -29,12 +29,14 @@ public sealed class QueryLatencyOverEfficiencyFilterAttributeTests
29
29
private readonly IFhirRuntimeConfiguration _azureApiForFhirConfiguration = new AzureApiForFhirRuntimeConfiguration ( ) ;
30
30
private readonly IFhirRuntimeConfiguration _azureHealthDataServicesFhirConfiguration = new AzureHealthDataServicesRuntimeConfiguration ( ) ;
31
31
32
- [ Fact ]
33
- public void GivenAValidHttpContextForAzureApiForFhir_WhenItContainsALatencyOverEfficiencyFlag_ThenFhirContextIsDecorated ( )
32
+ [ Theory ]
33
+ [ InlineData ( true ) ]
34
+ [ InlineData ( false ) ]
35
+ public void GivenAValidHttpContextForAzureApiForFhir_WhenItContainsALatencyOverEfficiencyFlag_ThenFhirContextIsDecorated ( bool azureApiForFhir )
34
36
{
35
37
var httpRequest = GetFakeHttpContext ( isLatencyOverEfficiencyEnabled : true ) ;
36
38
37
- var filter = new QueryLatencyOverEfficiencyFilterAttribute ( httpRequest . RequestContext , _azureApiForFhirConfiguration ) ;
39
+ var filter = new QueryLatencyOverEfficiencyFilterAttribute ( httpRequest . RequestContext , azureApiForFhir ? _azureApiForFhirConfiguration : _azureHealthDataServicesFhirConfiguration ) ;
38
40
filter . OnActionExecuting ( httpRequest . ActionContext ) ;
39
41
40
42
var fhirContextPropertyBag = httpRequest . RequestContext . RequestContext . Properties ;
@@ -43,27 +45,14 @@ public void GivenAValidHttpContextForAzureApiForFhir_WhenItContainsALatencyOverE
43
45
Assert . Equal ( true , fhirContextPropertyBag [ KnownQueryParameterNames . OptimizeConcurrency ] ) ;
44
46
}
45
47
46
- [ Fact ]
47
- public void GivenAValidHttpContextForAzureHealthDataService_WhenItContainsALatencyOverEfficiencyFlag_ThenFhirContextIsNotDecorated ( )
48
- {
49
- // The latency-over-efficiency flag is only applicable to Azure API for FHIR.
50
-
51
- var httpRequest = GetFakeHttpContext ( isLatencyOverEfficiencyEnabled : true ) ;
52
-
53
- var filter = new QueryLatencyOverEfficiencyFilterAttribute ( httpRequest . RequestContext , _azureHealthDataServicesFhirConfiguration ) ;
54
- filter . OnActionExecuting ( httpRequest . ActionContext ) ;
55
-
56
- var fhirContextPropertyBag = httpRequest . RequestContext . RequestContext . Properties ;
57
-
58
- Assert . False ( fhirContextPropertyBag . ContainsKey ( KnownQueryParameterNames . OptimizeConcurrency ) ) ;
59
- }
60
-
61
- [ Fact ]
62
- public void GivenAValidHttpContext_WhenItDoesNotContainALatencyOverEfficiencyFlag_ThenFhirContextIsClean ( )
48
+ [ Theory ]
49
+ [ InlineData ( true ) ]
50
+ [ InlineData ( false ) ]
51
+ public void GivenAValidHttpContext_WhenItDoesNotContainALatencyOverEfficiencyFlag_ThenFhirContextIsClean ( bool azureApiForFhir )
63
52
{
64
53
var httpRequest = GetFakeHttpContext ( isLatencyOverEfficiencyEnabled : false ) ;
65
54
66
- var filter = new QueryLatencyOverEfficiencyFilterAttribute ( httpRequest . RequestContext , _azureApiForFhirConfiguration ) ;
55
+ var filter = new QueryLatencyOverEfficiencyFilterAttribute ( httpRequest . RequestContext , azureApiForFhir ? _azureApiForFhirConfiguration : _azureHealthDataServicesFhirConfiguration ) ;
67
56
filter . OnActionExecuting ( httpRequest . ActionContext ) ;
68
57
69
58
var fhirContextPropertyBag = httpRequest . RequestContext . RequestContext . Properties ;
0 commit comments