public void RestartsWebsiteSlot()
        {
            // Setup
            const string websiteName = "website1";
            const string slot        = "staging";

            Mock <IWebsitesClient> websitesClientMock = new Mock <IWebsitesClient>();

            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, slot));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime = new MockCommandRuntime(),
                Name           = websiteName,
                WebsitesClient = websitesClientMock.Object,
                Slot           = slot
            };

            currentProfile = new AzureProfile();
            var subscription = new AzureSubscription {
                Id = new Guid(base.subscriptionId)
            };

            subscription.Properties[AzureSubscription.Property.Default] = "True";
            currentProfile.Subscriptions[new Guid(base.subscriptionId)] = subscription;

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, slot), Times.Once());
        }
        public void RestartsWebsiteSlot()
        {
            // Setup
            const string websiteName = "website1";
            const string slot        = "staging";

            Mock <IWebsitesClient> websitesClientMock = new Mock <IWebsitesClient>();

            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, slot));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime = new MockCommandRuntime(),
                Name           = websiteName,
                WebsitesClient = websitesClientMock.Object,
                Slot           = slot
            };

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

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, slot), Times.Once());
        }
        public void RestartsWebsiteSlot()
        {
            // Setup
            const string websiteName = "website1";
            const string slot        = "staging";

            Mock <IWebsitesClient> websitesClientMock = new Mock <IWebsitesClient>();

            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, slot));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime      = new MockCommandRuntime(),
                Name                = websiteName,
                CurrentSubscription = new WindowsAzureSubscription {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = websitesClientMock.Object,
                Slot           = slot
            };

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, slot), Times.Once());
        }
        public void ProcessRestartWebsiteTest()
        {
            // Setup
            const string           websiteName        = "website1";
            Mock <IWebsitesClient> websitesClientMock = new Mock <IWebsitesClient>();

            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, null));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime = new MockCommandRuntime(),
                Name           = websiteName,
                WebsitesClient = websitesClientMock.Object
            };

            currentProfile = new AzureSMProfile();
            var subscription = new AzureSubscription {
                Id = base.subscriptionId
            };

            subscription.SetDefault();
            currentProfile.SubscriptionTable[new Guid(base.subscriptionId)] = subscription;

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, null), Times.Once());
        }
        public void ProcessRestartWebsiteTest()
        {
            // Setup
            const string websiteName = "website1";
            Mock<IWebsitesClient> websitesClientMock = new Mock<IWebsitesClient>();
            websitesClientMock.Setup(f => f.RestartWebsite(websiteName, null));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                CommandRuntime = new MockCommandRuntime(),
                Name = websiteName,
                CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId },
                WebsitesClient = websitesClientMock.Object
            };

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartWebsite(websiteName, null), Times.Once());
        }
Пример #6
0
        public void ProcessRestartWebsiteTest()
        {
            // Setup
            const string           websiteName        = "website1";
            Mock <IWebsitesClient> websitesClientMock = new Mock <IWebsitesClient>();

            websitesClientMock.Setup(f => f.RestartAzureWebsite(websiteName));

            // Test
            RestartAzureWebsiteCommand restartAzureWebsiteCommand = new RestartAzureWebsiteCommand()
            {
                ShareChannel        = true,
                CommandRuntime      = new MockCommandRuntime(),
                Name                = websiteName,
                CurrentSubscription = new SubscriptionData {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = websitesClientMock.Object
            };

            restartAzureWebsiteCommand.ExecuteCmdlet();

            websitesClientMock.Verify(f => f.RestartAzureWebsite(websiteName), Times.Once());
        }