public void SaveAzureWebsiteLogWithNoFileExtensionTest() { TestExecutionHelpers.RetryAction( () => { // Setup string expectedOutput = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "file_without_ext.zip"); SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement { DownloadLogsThunk = ar => new MemoryStream(Encoding.UTF8.GetBytes("test with no extension")) }; // Test SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand(deploymentChannel) { Name = "website1", ShareChannel = true, WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), Output = "file_without_ext" }; currentProfile = new AzureSMProfile(); var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; subscription.Properties[AzureSubscription.Property.Default] = "True"; currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; getAzureWebsiteLogCommand.DefaultCurrentPath = AppDomain.CurrentDomain.BaseDirectory; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.Equal("test with no extension", FileUtilities.DataStore.ReadFileAsText(expectedOutput)); }); }
public void SaveAzureWebsiteLogTest() { // Setup SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement { DownloadLogsThunk = ar => new MemoryStream(Encoding.UTF8.GetBytes("test")) }; // Test SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand(deploymentChannel) { Name = "website1", ShareChannel = true, WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; currentProfile = new AzureSMProfile(); var subscription = new AzureSubscription { Id = new Guid(base.subscriptionId) }; subscription.Properties[AzureSubscription.Property.Default] = "True"; currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription; getAzureWebsiteLogCommand.DefaultCurrentPath = AppDomain.CurrentDomain.BaseDirectory; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.Equal("test", FileUtilities.DataStore.ReadFileAsText( Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SaveAzureWebsiteLogCommand.DefaultOutput))); }
public void SaveAzureWebsiteLogTest() { // Setup SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement { DownloadLogsThunk = ar => new MemoryStream(Encoding.UTF8.GetBytes("test")) }; // Test SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand(deploymentChannel) { Name = "website1", ShareChannel = true, WebsitesClient = clientMock.Object, CommandRuntime = new MockCommandRuntime(), }; AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.Equal("test", FileUtilities.DataStore.ReadFileAsText(SaveAzureWebsiteLogCommand.DefaultOutput)); }