public void EnableAzureWebsiteApplicationDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.FileSystem,
                                         properties, null));

            SetupProfile(null);

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name           = websiteName,
                WebsitesClient = websitesClientMock.Object,
                File           = true,
                LogLevel       = LogEntryType.Information
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.FileSystem,
                                          properties, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
Exemple #2
0
        public void EnableAzureWebsiteApplicationDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.FileSystem,
                                         properties, null));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name           = websiteName,
                WebsitesClient = websitesClientMock.Object,
                File           = true,
                LogLevel       = LogEntryType.Information
            };

            AzureSession.SetCurrentContext(new AzureSubscription {
                Id = new System.Guid(base.subscriptionId)
            }, null, null);

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.FileSystem,
                                          properties, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
        public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
        {
            // Setup
            string storageName = "MyStorage";

            properties[DiagnosticProperties.StorageAccountName] = storageName;
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.StorageTable,
                                         properties, null));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new WindowsAzureSubscription {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient     = websitesClientMock.Object,
                Storage            = true,
                LogLevel           = LogEntryType.Information,
                StorageAccountName = storageName
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.StorageTable,
                                          properties, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
        public void EnableAzureWebsiteApplicationDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.FileSystem,
                properties));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name = websiteName,
                CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId },
                WebsitesClient = websitesClientMock.Object,
                File = true,
                LogLevel = LogEntryType.Information
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.FileSystem,
                properties), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
Exemple #5
0
        public void EnableAzureWebsiteApplicationDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.FileSystem,
                                         properties));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                ShareChannel        = true,
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new SubscriptionData {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = websitesClientMock.Object,
                File           = true,
                LogLevel       = LogEntryType.Information
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.FileSystem,
                                          properties), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
Exemple #6
0
        public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
        {
            // Setup
            string storageName = "MyStorage";
            string tableName   = "MyTable";

            properties[DiagnosticProperties.StorageAccountName] = storageName;
            properties[DiagnosticProperties.StorageTableName]   = tableName.ToLowerInvariant();
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.StorageTable,
                                         properties, null));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime     = commandRuntimeMock.Object,
                Name               = websiteName,
                WebsitesClient     = websitesClientMock.Object,
                TableStorage       = true,
                LogLevel           = LogEntryType.Information,
                StorageAccountName = storageName,
                StorageTableName   = tableName
            };

            AzureSession.SetCurrentContext(new AzureSubscription {
                Id = new System.Guid(base.subscriptionId)
            }, null, null);

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.StorageTable,
                                          properties, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
        public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
        {
            // Setup
            string storageName = "MyStorage";
            string tableName   = "MyTable";

            properties[DiagnosticProperties.StorageAccountName] = storageName;
            properties[DiagnosticProperties.StorageTableName]   = tableName.ToLowerInvariant();
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.StorageTable,
                                         properties, null));

            SetupProfile(null);

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime     = commandRuntimeMock.Object,
                Name               = websiteName,
                WebsitesClient     = websitesClientMock.Object,
                TableStorage       = true,
                LogLevel           = LogEntryType.Information,
                StorageAccountName = storageName,
                StorageTableName   = tableName
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteWithProcessing();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.StorageTable,
                                          properties, null), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
        public void EnableApplicationDiagnosticOnSlot()
        {
            string slot = "staging";

            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.FileSystem,
                                         properties,
                                         slot));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new WindowsAzureSubscription {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = websitesClientMock.Object,
                File           = true,
                LogLevel       = LogEntryType.Information,
                Slot           = slot
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                                          websiteName,
                                          WebsiteDiagnosticOutput.FileSystem,
                                          properties,
                                          slot), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
        public void EnableAzureWebsiteApplicationDiagnosticApplicationTableLog()
        {
            // Setup
            string storageName = "MyStorage";
            properties[DiagnosticProperties.StorageAccountName] = storageName;
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.StorageTable,
                properties));

            enableAzureWebsiteApplicationDiagnosticCommand = new EnableAzureWebsiteApplicationDiagnosticCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name = websiteName,
                CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId },
                WebsitesClient = websitesClientMock.Object,
                Storage = true,
                LogLevel = LogEntryType.Information,
                StorageAccountName = storageName
            };

            // Test
            enableAzureWebsiteApplicationDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableApplicationDiagnostic(
                websiteName,
                WebsiteDiagnosticOutput.StorageTable,
                properties), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }