예제 #1
0
        public void EnableAzureWebsiteDiagnosticApplication()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableApplicationDiagnostic(
                                         websiteName,
                                         WebsiteDiagnosticOutput.FileSystem,
                                         properties));

            enableAzureWebsiteDiagnosticCommand = new EnableAzureWebsiteDiagnosticCommand()
            {
                ShareChannel        = true,
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new SubscriptionData {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = websitesClientMock.Object,
                Type           = WebsiteDiagnosticType.Application,
                Output         = WebsiteDiagnosticOutput.FileSystem,
                LogLevel       = LogEntryType.Information
            };

            // Test
            enableAzureWebsiteDiagnosticCommand.ExecuteCmdlet();

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

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
예제 #2
0
        public void EnableAzureWebsiteDiagnosticSiteIgnoreSetting()
        {
            // Setup
            websitesClientMock.Setup(f => f.EnableSiteDiagnostic(
                                         websiteName,
                                         true,
                                         false,
                                         true));

            enableAzureWebsiteDiagnosticCommand = new EnableAzureWebsiteDiagnosticCommand()
            {
                ShareChannel        = true,
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new SubscriptionData {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient       = websitesClientMock.Object,
                WebServerLogging     = true,
                FailedRequestTracing = true,
                Type = WebsiteDiagnosticType.Site
            };

            // Test
            enableAzureWebsiteDiagnosticCommand.ExecuteCmdlet();

            // Assert
            websitesClientMock.Verify(f => f.EnableSiteDiagnostic(
                                          websiteName,
                                          true,
                                          false,
                                          true), Times.Once());

            commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Never());
        }
예제 #3
0
        public void EnableAzureWebsiteDiagnosticApplicationTableLogUseCurrentStorageAccount()
        {
            // Setup
            string storageName = "MyStorage";

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

            enableAzureWebsiteDiagnosticCommand = new EnableAzureWebsiteDiagnosticCommand()
            {
                ShareChannel        = true,
                CommandRuntime      = commandRuntimeMock.Object,
                Name                = websiteName,
                CurrentSubscription = new SubscriptionData
                {
                    SubscriptionId        = base.subscriptionId,
                    CurrentStorageAccount = storageName
                },
                WebsitesClient = websitesClientMock.Object,
                Type           = WebsiteDiagnosticType.Application,
                Output         = WebsiteDiagnosticOutput.StorageTable,
                LogLevel       = LogEntryType.Information,
            };

            // Test
            enableAzureWebsiteDiagnosticCommand.ExecuteCmdlet();

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

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