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)); }
public void SaveAzureWebsiteLogWithSlotTest() { // 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(), CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId }, Slot = slot }; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.AreEqual("test", File.ReadAllText(SaveAzureWebsiteLogCommand.DefaultOutput)); }
public void SaveAzureWebsiteLogTest() { // Setup SimpleWebsitesManagement channel = new SimpleWebsitesManagement(); channel.GetWebSpacesThunk = ar => new WebSpaces(new List<WebSpace> { new WebSpace { Name = "webspace1" }, new WebSpace { Name = "webspace2" } }); channel.GetSitesThunk = ar => { if (ar.Values["webspaceName"].Equals("webspace1")) { return new Sites(new List<Site> { new Site { Name = "website1", WebSpace = "webspace1", SiteProperties = new SiteProperties { Properties = new List<NameValuePair> { new NameValuePair { Name = "repositoryuri", Value = "http" }, new NameValuePair { Name = "PublishingUsername", Value = "user1" }, new NameValuePair { Name = "PublishingPassword", Value = "password1" } } }} }); } return new Sites(new List<Site> { new Site { Name = "website2", WebSpace = "webspace2" } }); }; SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement { DownloadLogsThunk = ar => new MemoryStream(Encoding.UTF8.GetBytes("test")) }; // Test SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand(channel, deploymentChannel) { Name = "website1", ShareChannel = true, CommandRuntime = new MockCommandRuntime(), CurrentSubscription = new SubscriptionData { SubscriptionId = base.subscriptionName } }; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.AreEqual("test", File.ReadAllText(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(), CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId } }; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.AreEqual("test", File.ReadAllText(SaveAzureWebsiteLogCommand.DefaultOutput)); }
public void SaveAzureWebsiteLogWithNoFileExtensionTest() { // Setup SimpleWebsitesManagement channel = new SimpleWebsitesManagement(); string expectedOutput = "file_without_ext.zip"; channel.GetWebSpacesThunk = ar => new WebSpaces(new List <WebSpace> { new WebSpace { Name = "webspace1" }, new WebSpace { Name = "webspace2" } }); channel.GetSitesThunk = ar => { if (ar.Values["webspaceName"].Equals("webspace1")) { return(new Sites(new List <Site> { new Site { Name = "website1", WebSpace = "webspace1", SiteProperties = new SiteProperties { Properties = new List <NameValuePair> { new NameValuePair { Name = "repositoryuri", Value = "http" }, new NameValuePair { Name = "PublishingUsername", Value = "user1" }, new NameValuePair { Name = "PublishingPassword", Value = "password1" } } } } })); } return(new Sites(new List <Site> { new Site { Name = "website2", WebSpace = "webspace2" } })); }; SimpleDeploymentServiceManagement deploymentChannel = new SimpleDeploymentServiceManagement { DownloadLogsThunk = ar => new MemoryStream(Encoding.UTF8.GetBytes("test with no extnsion")) }; // Test SaveAzureWebsiteLogCommand getAzureWebsiteLogCommand = new SaveAzureWebsiteLogCommand(channel, deploymentChannel) { Name = "website1", ShareChannel = true, CommandRuntime = new MockCommandRuntime(), CurrentSubscription = new SubscriptionData { SubscriptionId = base.subscriptionId }, Output = "file_without_ext" }; getAzureWebsiteLogCommand.DefaultCurrentPath = ""; getAzureWebsiteLogCommand.ExecuteCmdlet(); Assert.AreEqual("test with no extnsion", File.ReadAllText(expectedOutput)); }