public static async Task UploadTestApplicationPackageIfNotAlreadyUploadedAsync( string appPackageName, string applicationVersion, string accountName, string resourceGroupName) { using BatchManagementClient mgmtClient = IntegrationTestCommon.OpenBatchManagementClient(); IPage <Application> applicationSummaries = await mgmtClient.Application.ListAsync(resourceGroupName, accountName).ConfigureAwait(false); bool testPackageAlreadyUploaded = applicationSummaries.Any(a => string.Equals(appPackageName, a.Id, StringComparison.OrdinalIgnoreCase)); if (!testPackageAlreadyUploaded) { const string format = "zip"; var addResponse = await mgmtClient.ApplicationPackage.CreateAsync(resourceGroupName, accountName, appPackageName, applicationVersion) .ConfigureAwait(false); var storageUrl = addResponse.StorageUrl; await IntegrationTestCommon.UploadTestApplicationAsync(storageUrl).ConfigureAwait(false); await mgmtClient.ApplicationPackage.ActivateAsync( resourceGroupName, accountName, appPackageName, applicationVersion, format).ConfigureAwait(false); } }
private static async Task UploadTestApplicationAndActivateAsync(string appPackageName, string applicationVersion, string resourceGroupName, string accountName) { const string format = "zip"; using (BatchManagementClient mgmtClient = IntegrationTestCommon.OpenBatchManagementClient()) { var addResponse = await mgmtClient.ApplicationPackage.CreateAsync(resourceGroupName, accountName, appPackageName, applicationVersion).ConfigureAwait(false); var storageUrl = addResponse.StorageUrl; await IntegrationTestCommon.UploadTestApplicationAsync(storageUrl).ConfigureAwait(false); await mgmtClient.ApplicationPackage.ActivateAsync(resourceGroupName, accountName, appPackageName, applicationVersion, format).ConfigureAwait(false); } }