|
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 2 | +// Licensed under the MIT License. See License.txt in the project root for license information. |
| 3 | + |
| 4 | +using System; |
| 5 | +using System.Collections.Generic; |
| 6 | +using System.Linq; |
| 7 | +using System.Text; |
| 8 | +using System.Threading.Tasks; |
| 9 | +using Microsoft.Azure.WebJobs.Script.Config; |
| 10 | +using Xunit; |
| 11 | + |
| 12 | +namespace Microsoft.Azure.WebJobs.Script.Tests |
| 13 | +{ |
| 14 | + public class ScriptSettingsManagerTests |
| 15 | + { |
| 16 | + [Theory] |
| 17 | + [InlineData("testsite", "production", "testsite")] |
| 18 | + [InlineData("testsite", "Production", "testsite")] |
| 19 | + [InlineData("testsite", null, "testsite")] |
| 20 | + [InlineData("testsite", "staging", "testsite-staging")] |
| 21 | + [InlineData("testsite", "dev", "testsite-dev")] |
| 22 | + [InlineData("TestSite", "Dev", "testsite-dev")] |
| 23 | + public void UniqueSlotName_ReturnsExpectedValue(string siteName, string slotName, string expectedValue) |
| 24 | + { |
| 25 | + var settingsManager = ScriptSettingsManager.Instance; |
| 26 | + |
| 27 | + var variables = new Dictionary<string, string> |
| 28 | + { |
| 29 | + { EnvironmentSettingNames.AzureWebsiteName, siteName }, |
| 30 | + { EnvironmentSettingNames.AzureWebsiteSlotName, slotName }, |
| 31 | + }; |
| 32 | + |
| 33 | + using (var tempVariables = new TestScopedEnvironmentVariable(variables)) |
| 34 | + { |
| 35 | + Assert.Equal(expectedValue, ScriptSettingsManager.Instance.AzureWebsiteUniqueSlotName); |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | +} |
0 commit comments