/// <summary> /// When running this test double check that the certificate used in Azure.PublishSettings has not expired. /// </summary> public PublishContextTests() { AzurePowerShell.ProfileDirectory = Test.Utilities.Common.Data.AzureSdkAppDir; service = new AzureServiceWrapper(Directory.GetCurrentDirectory(), Path.GetRandomFileName(), null); service.CreateVirtualCloudPackage(); packagePath = service.Paths.CloudPackage; configPath = service.Paths.CloudConfiguration; settings = ServiceSettingsTestData.Instance.Data[ServiceSettingsState.Default]; ProfileClient.DataStore = new MockDataStore(); ProfileClient client = new ProfileClient(); ProfileClient.DataStore.WriteFile(Test.Utilities.Common.Data.ValidPublishSettings.First(), File.ReadAllText(Test.Utilities.Common.Data.ValidPublishSettings.First())); client.ImportPublishSettings(Test.Utilities.Common.Data.ValidPublishSettings.First(), null); client.Profile.Save(); }
/// <summary> /// Create a temporary Azure SDK directory to simulate global files. /// </summary> /// <param name="publishSettingsPath"> /// Path to the publish settings. /// </param> /// <returns>The path to the temporary Azure SDK directory.</returns> public string CreateAzureSdkDirectoryAndImportPublishSettings(string publishSettingsPath) { Debug.Assert(!string.IsNullOrEmpty(publishSettingsPath)); Debug.Assert(File.Exists(publishSettingsPath)); Debug.Assert(string.IsNullOrEmpty(AzureSdkPath)); AzureSdkPath = CreateDirectory("AzureSdk"); ProfileClient client = new ProfileClient(); ProfileClient.DataStore.WriteFile(publishSettingsPath, File.ReadAllText(publishSettingsPath)); client.ImportPublishSettings(publishSettingsPath, null); client.Profile.Save(); return AzureSdkPath; }