public void VerifyCanSetRoleNameFromHeaders() { var roleNameContainer = new RoleNameContainer(hostNameSuffix: ".azurewebsites.net"); var headers = new HeaderDictionary(); headers.Add("WAS-DEFAULT-HOSTNAME", "d.e.f.azurewebsites.net"); roleNameContainer.Set(headers); Assert.Equal("d.e.f", roleNameContainer.RoleName); }
public void VerifyEmptyHeadersDoNotOverwriteEnvironmentVaribaleValue() { try { Environment.SetEnvironmentVariable("WEBSITE_HOSTNAME", "a.b.c.azurewebsites.net"); var roleNameContainer = new RoleNameContainer(hostNameSuffix: ".azurewebsites.net"); Assert.Equal("a.b.c", roleNameContainer.RoleName); roleNameContainer.Set(new HeaderDictionary()); // empty headers Assert.Equal("a.b.c", roleNameContainer.RoleName); } finally { this.ClearEnvironmentVariable(); } }