public async Task CanRemoveElementFromBlobConfigFile(string userId, string roleName, string fileId, bool expectedResult) { var policy = await AzureStorageHelper.GetConfigFileAsync(fileId); PolicyServerRuntimeManager = new PolicyServerRuntimeManager(policy); PolicyServerRuntimeManager.RemoveUserFromRole(userId, roleName); var result = await PolicyServerRuntimeManager.SaveChangesAsync(fileId); Assert.Equal(expectedResult, result); }
public async Task CustomBlobStorage() { Environment.SetEnvironmentVariable("AzureBlobStorage", "UseDevelopmentStorage=true;custom"); try { var policy = await AzureStorageHelper.GetConfigFileAsync(); } catch (FormatException sex) { // Clear variable Environment.SetEnvironmentVariable("AzureBlobStorage", string.Empty); Assert.StartsWith("Settings must be of the form", sex.Message); } }
public async Task CustomContainerName() { Environment.SetEnvironmentVariable("AzureBlobContainerName", "wrong-container-name"); try { var policy = await AzureStorageHelper.GetConfigFileAsync(); } catch (StorageException sex) { // Clear variable Environment.SetEnvironmentVariable("AzureBlobContainerName", string.Empty); Assert.Contains("The specified container does not exist.", sex.Message); } }
public async Task NotExistantBlobConfigFile() { Environment.SetEnvironmentVariable("AzureBlobContainerName", "azure-webjobs-hosts"); try { var policy = await AzureStorageHelper.GetConfigFileAsync(); } catch (StorageException sex) { // Clear variable Environment.SetEnvironmentVariable("AzureBlobContainerName", string.Empty); Assert.Contains("The specified blob does not exist.", sex.Message); } }
public async Task CanGetClientConfigFile(string fileId, Type expectedResult) { var policy = await AzureStorageHelper.GetConfigFileAsync(fileId); Assert.True(policy.GetType() == expectedResult); }