예제 #1
0
        public void ProcessShowWebsiteTest()
        {
            // Setup
            var mockClient = new Mock <IWebsitesClient>();

            mockClient.Setup(c => c.GetWebsite("website1", null))
            .Returns(new Site
            {
                Name      = "website1",
                WebSpace  = "webspace1",
                HostNames = new[] { "website1.cloudapp.com" }
            });

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                Name           = "website1",
                WebsitesClient = mockClient.Object
            };

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

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
예제 #2
0
        public void ProcessShowWebsiteTest()
        {
            // Setup
            var mockClient = new Mock <IWebsitesClient>();

            mockClient.Setup(c => c.GetWebsite("website1", null))
            .Returns(new Site
            {
                Name      = "website1",
                WebSpace  = "webspace1",
                HostNames = new[] { "website1.cloudapp.com" }
            });

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                Name           = "website1",
                WebsitesClient = mockClient.Object
            };

            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;

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
        public void ProcessShowWebsiteTest()
        {
            // Setup
            var mockClient = new Mock <IWebsitesClient>();

            mockClient.Setup(c => c.GetWebsite("website1"))
            .Returns(new Site
            {
                Name      = "website1",
                WebSpace  = "webspace1",
                HostNames = new[] { "website1.cloudapp.com" }
            });

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand
            {
                CommandRuntime      = new MockCommandRuntime(),
                Name                = "website1",
                CurrentSubscription = new WindowsAzureSubscription {
                    SubscriptionId = base.subscriptionId
                },
                WebsitesClient = mockClient.Object
            };

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
예제 #4
0
        public void ProcessShowWebsiteTest()
        {
            // Setup
            SimpleWebsitesManagement channel = new SimpleWebsitesManagement();

            channel.GetWebSpacesThunk = ar => new WebSpaces(new List <WebSpace> {
                new WebSpace {
                    Name = "webspace1"
                }, new WebSpace {
                    Name = "webspace2"
                }
            });
            channel.GetSitesThunk = ar =>
            {
                if (ar.Values["webspaceName"].Equals("webspace1"))
                {
                    return(new Sites(new List <Site> {
                        new Site {
                            Name = "website1", WebSpace = "webspace1", HostNames = new [] { "website1.cloudapp.com" }
                        }
                    }));
                }

                return(new Sites(new List <Site> {
                    new Site {
                        Name = "website2", WebSpace = "webspace2", HostNames = new[] { "website2.cloudapp.com" }
                    }
                }));
            };
            channel.GetSiteConfigThunk = ar =>
            {
                if (ar.Values["name"].Equals("website1") && ar.Values["webspaceName"].Equals("webspace1"))
                {
                    return(new SiteConfig
                    {
                        PublishingUsername = "******"
                    });
                }

                return(null);
            };

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand(channel)
            {
                ShareChannel        = true,
                CommandRuntime      = new MockCommandRuntime(),
                Name                = "website1",
                CurrentSubscription = new SubscriptionData {
                    SubscriptionId = base.subscriptionId
                }
            };

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
        public void ProcessShowWebsiteTest()
        {
            // Setup
            SimpleWebsitesManagement channel = new SimpleWebsitesManagement();
            channel.GetWebSpacesThunk = ar => new WebSpaces(new List<WebSpace> { new WebSpace { Name = "webspace1" }, new WebSpace { Name = "webspace2" } });
            channel.GetSitesThunk = ar =>
            {
                if (ar.Values["webspaceName"].Equals("webspace1"))
                {
                    return new Sites(new List<Site> { new Site { Name = "website1", WebSpace = "webspace1", HostNames = new [] {"website1.cloudapp.com" } } });
                }

                return new Sites(new List<Site> { new Site { Name = "website2", WebSpace = "webspace2", HostNames = new[] { "website2.cloudapp.com" } } });
            };
            channel.GetSiteConfigThunk = ar =>
            {
                if (ar.Values["name"].Equals("website1") && ar.Values["webspaceName"].Equals("webspace1"))
                {
                    return new SiteConfig
                    {
                        PublishingUsername = "******"
                    };
                }

                return null;
            };

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand(channel)
            {
                ShareChannel = true,
                CommandRuntime = new MockCommandRuntime(),
                Name = "website1",
                CurrentSubscription = new SubscriptionData { SubscriptionId = base.subscriptionName }
            };

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }
        public void ProcessShowWebsiteTest()
        {
            // Setup
            var mockClient = new Mock<IWebsitesClient>();
            mockClient.Setup(c => c.GetWebsite("website1", null))
                .Returns(new Site
                {
                    Name = "website1",
                    WebSpace = "webspace1",
                    HostNames = new[] {"website1.cloudapp.com"}
                });

            // Test
            ShowAzureWebsiteCommand showAzureWebsiteCommand = new ShowAzureWebsiteCommand
            {
                CommandRuntime = new MockCommandRuntime(),
                Name = "website1",
                CurrentSubscription = new WindowsAzureSubscription { SubscriptionId = base.subscriptionId },
                WebsitesClient = mockClient.Object
            };

            // Show existing website
            showAzureWebsiteCommand.ExecuteCmdlet();
        }