@@ -1066,6 +1066,63 @@ public void SelectFeatureFlags()
1066
1066
Assert . Null ( config [ "FeatureManagement:App2_Feature2" ] ) ;
1067
1067
}
1068
1068
1069
+ [ Fact ]
1070
+ public void SelectOrderDoesNotAffectLoad ( )
1071
+ {
1072
+ var mockResponse = new Mock < Response > ( ) ;
1073
+ var mockClient = new Mock < ConfigurationClient > ( MockBehavior . Strict ) ;
1074
+
1075
+ List < ConfigurationSetting > kvCollection = new List < ConfigurationSetting >
1076
+ {
1077
+ ConfigurationModelFactory . ConfigurationSetting ( "TestKey1" , "TestValue1" , "label" ,
1078
+ eTag : new ETag ( "0a76e3d7-7ec1-4e37-883c-9ea6d0d89e63" ) ) ,
1079
+ ConfigurationModelFactory . ConfigurationSetting ( "TestKey2" , "TestValue2" , "label" ,
1080
+ eTag : new ETag ( "31c38369-831f-4bf1-b9ad-79db56c8b989" ) )
1081
+ } ;
1082
+
1083
+ MockAsyncPageable GetTestKeys ( SettingSelector selector , CancellationToken ct )
1084
+ {
1085
+ List < ConfigurationSetting > settingCollection ;
1086
+
1087
+ if ( selector . KeyFilter . StartsWith ( FeatureManagementConstants . FeatureFlagMarker ) )
1088
+ {
1089
+ settingCollection = _featureFlagCollection ;
1090
+ }
1091
+ else
1092
+ {
1093
+ settingCollection = kvCollection ;
1094
+ }
1095
+
1096
+ var copy = new List < ConfigurationSetting > ( ) ;
1097
+ var newSetting = settingCollection . FirstOrDefault ( s => ( s . Key == selector . KeyFilter && s . Label == selector . LabelFilter ) ) ;
1098
+ if ( newSetting != null )
1099
+ copy . Add ( TestHelpers . CloneSetting ( newSetting ) ) ;
1100
+ return new MockAsyncPageable ( copy ) ;
1101
+ }
1102
+
1103
+ mockClient . Setup ( c => c . GetConfigurationSettingsAsync ( It . IsAny < SettingSelector > ( ) , It . IsAny < CancellationToken > ( ) ) )
1104
+ . Returns ( ( Func < SettingSelector , CancellationToken , MockAsyncPageable > ) GetTestKeys ) ;
1105
+
1106
+ var config = new ConfigurationBuilder ( )
1107
+ . AddAzureAppConfiguration ( options =>
1108
+ {
1109
+ options . ClientManager = TestHelpers . CreateMockedConfigurationClientManager ( mockClient . Object ) ;
1110
+ options . UseFeatureFlags ( ff =>
1111
+ {
1112
+ ff . Select ( "App1_Feature1" , "App1_Label" ) ;
1113
+ ff . Select ( "App2_Feature1" , "App2_Label" ) ;
1114
+ } ) ;
1115
+ options . Select ( "TestKey1" , "label" ) ;
1116
+ options . Select ( "TestKey2" , "label" ) ;
1117
+ } )
1118
+ . Build ( ) ;
1119
+
1120
+ Assert . Equal ( "True" , config [ "FeatureManagement:App1_Feature1" ] ) ;
1121
+ Assert . Equal ( "False" , config [ "FeatureManagement:App2_Feature1" ] ) ;
1122
+ Assert . Equal ( "TestValue1" , config [ "TestKey1" ] ) ;
1123
+ Assert . Equal ( "TestValue2" , config [ "TestKey2" ] ) ;
1124
+ }
1125
+
1069
1126
[ Fact ]
1070
1127
public void TestNullAndMissingValuesForConditions ( )
1071
1128
{
0 commit comments