public void ProcessRemoveWebsiteTest() { // Setup var mockClient = new Mock<IWebsitesClient>(); string slot = "staging"; mockClient.Setup(c => c.GetWebsite("website1", slot)) .Returns(new Site { Name = "website1", WebSpace = "webspace1" }); mockClient.Setup(c => c.DeleteWebsite("webspace1", "website1", slot)).Verifiable(); SetupProfile(null); // Test RemoveAzureWebsiteCommand removeAzureWebsiteCommand = new RemoveAzureWebsiteCommand { CommandRuntime = new MockCommandRuntime(), WebsitesClient = mockClient.Object, Name = "website1", Slot = slot }; // Delete existing website removeAzureWebsiteCommand.ExecuteWithProcessing(); mockClient.Verify(c => c.DeleteWebsite("webspace1", "website1", slot), Times.Once()); }
public void ProcessRemoveWebsiteTest() { // Setup var mockClient = new Mock<IWebsitesClient>(); string slot = "staging"; mockClient.Setup(c => c.GetWebsite("website1", slot)) .Returns(new Site { Name = "website1", WebSpace = "webspace1" }); mockClient.Setup(c => c.DeleteWebsite("webspace1", "website1", slot)).Verifiable(); // Test RemoveAzureWebsiteCommand removeAzureWebsiteCommand = new RemoveAzureWebsiteCommand { CommandRuntime = new MockCommandRuntime(), WebsitesClient = mockClient.Object, Name = "website1", Slot = slot }; AzureSession.SetCurrentContext(new AzureSubscription { Id = new Guid(base.subscriptionId) }, null, null); // Delete existing website removeAzureWebsiteCommand.ExecuteCmdlet(); mockClient.Verify(c => c.DeleteWebsite("webspace1", "website1", slot), Times.Once()); }