@@ -1119,6 +1119,132 @@ public void configuration_is_valid_with_duplicate_reroutes_different_verbs()
11191119 . BDDfy ( ) ;
11201120 }
11211121
1122+ [ Fact ]
1123+ public void configuration_is_not_valid_with_duplicate_reroutes_with_duplicated_upstreamhosts ( )
1124+ {
1125+ this . Given ( x => x . GivenAConfiguration ( new FileConfiguration
1126+ {
1127+ ReRoutes = new List < FileReRoute >
1128+ {
1129+ new FileReRoute
1130+ {
1131+ DownstreamPathTemplate = "/api/products/" ,
1132+ UpstreamPathTemplate = "/asdf/" ,
1133+ DownstreamHostAndPorts = new List < FileHostAndPort >
1134+ {
1135+ new FileHostAndPort
1136+ {
1137+ Host = "bbc.co.uk" ,
1138+ }
1139+ } ,
1140+ UpstreamHttpMethod = new List < string > ( ) ,
1141+ UpstreamHost = "upstreamhost"
1142+ } ,
1143+ new FileReRoute
1144+ {
1145+ DownstreamPathTemplate = "/www/test/" ,
1146+ UpstreamPathTemplate = "/asdf/" ,
1147+ DownstreamHostAndPorts = new List < FileHostAndPort >
1148+ {
1149+ new FileHostAndPort
1150+ {
1151+ Host = "bbc.co.uk" ,
1152+ }
1153+ } ,
1154+ UpstreamHttpMethod = new List < string > ( ) ,
1155+ UpstreamHost = "upstreamhost"
1156+ }
1157+ }
1158+ } ) )
1159+ . When ( x => x . WhenIValidateTheConfiguration ( ) )
1160+ . Then ( x => x . ThenTheResultIsNotValid ( ) )
1161+ . And ( x => x . ThenTheErrorMessageAtPositionIs ( 0 , "reRoute /asdf/ has duplicate" ) )
1162+ . BDDfy ( ) ;
1163+ }
1164+
1165+ [ Fact ]
1166+ public void configuration_is_valid_with_duplicate_reroutes_but_different_upstreamhosts ( )
1167+ {
1168+ this . Given ( x => x . GivenAConfiguration ( new FileConfiguration
1169+ {
1170+ ReRoutes = new List < FileReRoute >
1171+ {
1172+ new FileReRoute
1173+ {
1174+ DownstreamPathTemplate = "/api/products/" ,
1175+ UpstreamPathTemplate = "/asdf/" ,
1176+ DownstreamHostAndPorts = new List < FileHostAndPort >
1177+ {
1178+ new FileHostAndPort
1179+ {
1180+ Host = "bbc.co.uk" ,
1181+ }
1182+ } ,
1183+ UpstreamHttpMethod = new List < string > ( ) ,
1184+ UpstreamHost = "upstreamhost111"
1185+ } ,
1186+ new FileReRoute
1187+ {
1188+ DownstreamPathTemplate = "/www/test/" ,
1189+ UpstreamPathTemplate = "/asdf/" ,
1190+ DownstreamHostAndPorts = new List < FileHostAndPort >
1191+ {
1192+ new FileHostAndPort
1193+ {
1194+ Host = "bbc.co.uk" ,
1195+ }
1196+ } ,
1197+ UpstreamHttpMethod = new List < string > ( ) ,
1198+ UpstreamHost = "upstreamhost222"
1199+ }
1200+ }
1201+ } ) )
1202+ . When ( x => x . WhenIValidateTheConfiguration ( ) )
1203+ . Then ( x => x . ThenTheResultIsValid ( ) )
1204+ . BDDfy ( ) ;
1205+ }
1206+
1207+ [ Fact ]
1208+ public void configuration_is_valid_with_duplicate_reroutes_but_one_upstreamhost_is_not_set ( )
1209+ {
1210+ this . Given ( x => x . GivenAConfiguration ( new FileConfiguration
1211+ {
1212+ ReRoutes = new List < FileReRoute >
1213+ {
1214+ new FileReRoute
1215+ {
1216+ DownstreamPathTemplate = "/api/products/" ,
1217+ UpstreamPathTemplate = "/asdf/" ,
1218+ DownstreamHostAndPorts = new List < FileHostAndPort >
1219+ {
1220+ new FileHostAndPort
1221+ {
1222+ Host = "bbc.co.uk" ,
1223+ }
1224+ } ,
1225+ UpstreamHttpMethod = new List < string > ( ) ,
1226+ UpstreamHost = "upstreamhost"
1227+ } ,
1228+ new FileReRoute
1229+ {
1230+ DownstreamPathTemplate = "/www/test/" ,
1231+ UpstreamPathTemplate = "/asdf/" ,
1232+ DownstreamHostAndPorts = new List < FileHostAndPort >
1233+ {
1234+ new FileHostAndPort
1235+ {
1236+ Host = "bbc.co.uk" ,
1237+ }
1238+ } ,
1239+ UpstreamHttpMethod = new List < string > ( )
1240+ }
1241+ }
1242+ } ) )
1243+ . When ( x => x . WhenIValidateTheConfiguration ( ) )
1244+ . Then ( x => x . ThenTheResultIsValid ( ) )
1245+ . BDDfy ( ) ;
1246+ }
1247+
11221248 [ Fact ]
11231249 public void configuration_is_invalid_with_invalid_rate_limit_configuration ( )
11241250 {
0 commit comments