public void GetAdminToken_Succeeds() { // Arrange _mockEnvironment.Setup(p => p.GetEnvironmentVariable(It.Is <string>(k => k == EnvironmentSettingNames.ContainerName))).Returns <string>(v => v = "ContainerName"); var key = TestHelpers.GenerateKeyBytes(); var stringKey = TestHelpers.GenerateKeyHexString(key); using (new TestScopedEnvironmentVariable(EnvironmentSettingNames.WebSiteAuthEncryptionKey, stringKey)) { // Act ObjectResult result = (ObjectResult)_hostController.GetAdminToken(); HttpStatusCode resultStatus = (HttpStatusCode)result.StatusCode; string token = (string)result.Value; // Assert Assert.Equal(HttpStatusCode.OK, resultStatus); Assert.True(SimpleWebTokenHelper.ValidateToken(token, new SystemClock())); } }