public void StopsWebsiteSlot() { const string slot = "staging"; const string websiteName = "website1"; // Setup Mock<IWebsitesClient> websitesClientMock = new Mock<IWebsitesClient>(); websitesClientMock.Setup(f => f.StopWebsite(websiteName, slot)); // Test StopAzureWebsiteCommand stopAzureWebsiteCommand = new StopAzureWebsiteCommand() { 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; stopAzureWebsiteCommand.ExecuteCmdlet(); websitesClientMock.Verify(f => f.StopWebsite(websiteName, slot), Times.Once()); }
public void ProcessStopWebsiteTest() { const string websiteName = "website1"; // Setup Mock<IWebsitesClient> websitesClientMock = new Mock<IWebsitesClient>(); websitesClientMock.Setup(f => f.StopWebsite(websiteName, null)); // Test StopAzureWebsiteCommand stopAzureWebsiteCommand = new StopAzureWebsiteCommand() { CommandRuntime = new MockCommandRuntime(), Name = websiteName, WebsitesClient = websitesClientMock.Object }; AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); stopAzureWebsiteCommand.ExecuteCmdlet(); websitesClientMock.Verify(f => f.StopWebsite(websiteName, null), Times.Once()); }