Fixed issue causing a site's key property to take the next available value on creation.
This commit is contained in:
Родитель
a391f8dca8
Коммит
be84966dea
|
@ -55,12 +55,12 @@ namespace Microsoft.IIS.Administration.WebServer.Sites
|
|||
// Initialize new site settings
|
||||
SetToDefaults(site, sm.SiteDefaults);
|
||||
|
||||
// Set site settings to those provided
|
||||
SetSite(site, model, fileProvider);
|
||||
|
||||
// Initialize site Id by obtaining the first available
|
||||
site.Id = FirstAvailableId();
|
||||
|
||||
// Set site settings to those provided
|
||||
SetSite(site, model, fileProvider);
|
||||
|
||||
return site;
|
||||
}
|
||||
|
||||
|
|
|
@ -383,6 +383,36 @@ namespace Microsoft.IIS.Administration.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(99722)]
|
||||
public void CreateWithKey(int key)
|
||||
{
|
||||
using (HttpClient client = ApiHttpClient.Create()) {
|
||||
|
||||
EnsureNoSite(client, TEST_SITE_NAME);
|
||||
|
||||
var siteData = new {
|
||||
name = TEST_SITE_NAME,
|
||||
physical_path = TEST_SITE_PATH,
|
||||
key = key,
|
||||
bindings = new object[] {
|
||||
new {
|
||||
ip_address = "*",
|
||||
port = TEST_PORT,
|
||||
protocol = "http"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
JObject site = client.Post(SITE_URL, siteData);
|
||||
Assert.NotNull(site);
|
||||
|
||||
Assert.Equal(key, site.Value<int>("key"));
|
||||
|
||||
Assert.True(client.Delete(Utils.Self(site)));
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasExactProperties(JObject obj, IEnumerable<string> names) {
|
||||
if (obj.Properties().Count() != names.Count()) {
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче