public void ProcessGetAzureWebsiteLocationTest() { // Setup Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>(); Mock<ICommandRuntime> commandRuntimeMock = new Mock<ICommandRuntime>(); List<string> regions = new List<string>() {"West US", "North Moon", "Central West Sun"}; clientMock.Setup(f => f.ListAvailableLocations()).Returns(regions); // Test GetAzureWebsiteLocationCommand getAzureWebsiteCommand = new GetAzureWebsiteLocationCommand() { WebsitesClient = clientMock.Object, CommandRuntime = commandRuntimeMock.Object }; getAzureWebsiteCommand.ExecuteCmdlet(); clientMock.Verify(f => f.ListAvailableLocations(), Times.Once()); commandRuntimeMock.Verify(f => f.WriteObject(regions, true), Times.Once()); }
public void ProcessGetAzureWebsiteLocationTest() { // Setup SimpleWebsitesManagement channel = new SimpleWebsitesManagement(); // Test GetAzureWebsiteLocationCommand getAzureWebsiteCommand = new GetAzureWebsiteLocationCommand(channel) { ShareChannel = true, CommandRuntime = new MockCommandRuntime() }; getAzureWebsiteCommand.ExecuteCmdlet(); Assert.AreEqual(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); var locations = (IEnumerable<string>)((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.FirstOrDefault(); Assert.IsNotNull(locations); Assert.IsTrue(locations.Any(loc => loc.Equals("East US"))); Assert.IsTrue(locations.Any(loc => loc.Equals("West US"))); Assert.IsTrue(locations.Any(loc => loc.Equals("North Europe"))); Assert.IsTrue(locations.Any(loc => loc.Equals("West Europe"))); }
public void ProcessGetAzureWebsiteLocationTest() { // Setup SimpleWebsitesManagement channel = new SimpleWebsitesManagement(); // Test GetAzureWebsiteLocationCommand getAzureWebsiteCommand = new GetAzureWebsiteLocationCommand(channel) { ShareChannel = true, CommandRuntime = new MockCommandRuntime() }; getAzureWebsiteCommand.ExecuteCmdlet(); Assert.AreEqual(1, ((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.Count); var locations = (IEnumerable <string>)((MockCommandRuntime)getAzureWebsiteCommand.CommandRuntime).OutputPipeline.FirstOrDefault(); Assert.IsNotNull(locations); Assert.IsTrue(locations.Any(loc => loc.Equals("East US"))); Assert.IsTrue(locations.Any(loc => loc.Equals("West US"))); Assert.IsTrue(locations.Any(loc => loc.Equals("North Europe"))); Assert.IsTrue(locations.Any(loc => loc.Equals("West Europe"))); Assert.IsTrue(locations.Any(loc => loc.Equals("East Asia"))); }
public void ProcessGetAzureWebsiteLocationTest() { // Setup Mock <IWebsitesClient> clientMock = new Mock <IWebsitesClient>(); Mock <ICommandRuntime> commandRuntimeMock = new Mock <ICommandRuntime>(); List <string> regions = new List <string>() { "West US", "North Moon", "Central West Sun" }; clientMock.Setup(f => f.ListAvailableLocations()).Returns(regions); // Test GetAzureWebsiteLocationCommand getAzureWebsiteCommand = new GetAzureWebsiteLocationCommand() { WebsitesClient = clientMock.Object, CommandRuntime = commandRuntimeMock.Object }; getAzureWebsiteCommand.ExecuteCmdlet(); clientMock.Verify(f => f.ListAvailableLocations(), Times.Once()); commandRuntimeMock.Verify(f => f.WriteObject(regions, true), Times.Once()); }