Rename outbound rules 'rewrite' property to 'enabled'

This commit is contained in:
Jimmy Campbell 2017-08-01 18:10:39 -07:00
Родитель ee7dda429e
Коммит 3c666ebc81
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -340,9 +340,9 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
}
//
// rewrite
if (fields.Exists("rewrite")) {
obj.rewrite = rule.Action.Type == OutboundActionType.Rewrite ? true : false;
// enabled
if (fields.Exists("enabled")) {
obj.enabled = rule.Action.Type == OutboundActionType.Rewrite ? true : false;
}
//
@ -703,7 +703,7 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
}
DynamicHelper.If((object)model.pattern, v => rule.Match.Pattern = v);
DynamicHelper.If<bool>((object)model.rewrite, v => rule.Action.Type = v ? OutboundActionType.Rewrite : OutboundActionType.None);
DynamicHelper.If<bool>((object)model.enabled, v => rule.Action.Type = v ? OutboundActionType.Rewrite : OutboundActionType.None);
DynamicHelper.If((object)model.rewrite_value, v => rule.Action.RewriteValue = v);
DynamicHelper.If<bool>((object)model.ignore_case, v => rule.Match.IgnoreCase = v);
DynamicHelper.If<bool>((object)model.negate, v => rule.Match.Negate = v);

Просмотреть файл

@ -549,7 +549,7 @@ namespace Microsoft.IIS.Administration.Tests
ignore_case = false,
negate = true,
stop_processing = false,
rewrite = false,
enabled = false,
rewrite_value = "test rewrite value",
condition_match_constraints = "match_any",
track_all_captures = true,
@ -583,7 +583,7 @@ namespace Microsoft.IIS.Administration.Tests
ignore_case = true,
negate = false,
stop_processing = true,
rewrite = true,
enabled = true,
rewrite_value = "test rewrite update",
condition_match_constraints = "match_all",
track_all_captures = false,
@ -1082,7 +1082,7 @@ namespace Microsoft.IIS.Administration.Tests
Assert.Equal(a.Value<bool>("ignore_case"), b.Value<bool>("ignore_case"));
Assert.Equal(a.Value<bool>("negate"), b.Value<bool>("negate"));
Assert.Equal(a.Value<bool>("stop_processing"), b.Value<bool>("stop_processing"));
Assert.Equal(a.Value<bool>("rewrite"), b.Value<bool>("rewrite"));
Assert.Equal(a.Value<bool>("enabled"), b.Value<bool>("enabled"));
Assert.Equal(a.Value<string>("rewrite_value"), b.Value<string>("rewrite_value"));
Assert.Equal(a.Value<string>("condition_match_constraints"), b.Value<string>("condition_match_constraints"));
Assert.Equal(a.Value<bool>("track_all_captures"), b.Value<bool>("track_all_captures"));