상속: CloudProjectPathInfo
        public void SetAzureServiceProjectTestsLocationValid()
        {
            string[] locations = { "West US", "East US", "East Asia", "North Europe" };
            foreach (string item in locations)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    mockCommandRuntime = new MockCommandRuntime();
                    setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime;
                    settings.Save(paths.Settings);

                    settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(item, null, null, paths.Settings);

                    // Assert location is changed
                    //
                    Assert.Equal<string>(item, settings.Location);
                    ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings;
                    Assert.Equal<string>(item, settings.Location);
                }
            }
        }
 public CloudServiceProject(string cloudConfigurationFullPath)
 {
     Components = new ServiceComponents(cloudConfigurationFullPath);
     //since we are deploying from a prebuilt package, it doesn't matter whether
     //it comes from visual studio or powershell tools.
     //Here we just go with powershell one, because it is simple.
     Paths = new PowerShellProjectPathInfo(Path.GetDirectoryName(cloudConfigurationFullPath));
 }
 public void ServicePathInfoTestNullRootPathFail()
 {
     try
     {
         PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(null);
         Assert.True(false, "No exception was thrown");
     }
     catch (Exception ex)
     {
         Assert.True(ex is ArgumentException);
         Assert.Equal<string>(string.Format(Resources.InvalidOrEmptyArgumentMessage, "rootPath"), ex.Message);
     }
 }
        public void SetAzureServiceProjectTestsLocationEmptyFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows<ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(string.Empty, null, null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Location"));
            }
        }
        public CloudServiceProject(string rootPath, string scaffoldingPath)
        {
            SetScaffolding(scaffoldingPath);

            if (!VisualStudioProjectPathInfo.IsVisualStudioProject(rootPath))
            {
                Paths = new PowerShellProjectPathInfo(rootPath);
            }
            else
            {
                Paths = new VisualStudioProjectPathInfo(rootPath);
            }

            Components = new ServiceComponents(Paths);
        }
예제 #6
0
        public CloudServiceProject(string rootPath, string scaffoldingPath)
        {
            SetScaffolding(scaffoldingPath);

            if (!VisualStudioProjectPathInfo.IsVisualStudioProject(rootPath))
            {
                Paths = new PowerShellProjectPathInfo(rootPath);
            }
            else
            {
                Paths = new VisualStudioProjectPathInfo(rootPath);
            }

            Components = new ServiceComponents(Paths);
        }
 public void ServicePathInfoTestInvalidRootPathFail()
 {
     foreach (string invalidDirectoryName in Test.Utilities.Common.Data.InvalidServiceRootName)
     {
         try
         {
             PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(invalidDirectoryName);
             Assert.True(false, "No exception was thrown");
         }
         catch (Exception ex)
         {
             Assert.True(ex is ArgumentException);
             Assert.Equal<string>(Resources.InvalidRootNameMessage, ex.Message);
         }
     }
 }
        public void ServiceComponentsTestCloudConfigDoesNotExistFail()
        {
            newServiceCmdlet.NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
            PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(serviceName);

            try
            {
                File.Delete(paths.CloudConfiguration);
                ServiceComponents components = new ServiceComponents(paths);
                Assert.True(false, "No exception was thrown");
            }
            catch (Exception ex)
            {
                Assert.True(ex is FileNotFoundException);
                Assert.Equal<string>(ex.Message, string.Format(Resources.PathDoesNotExistForElement, Resources.ServiceConfiguration, paths.CloudConfiguration));
            }
        }
        public CloudServiceProject(string rootPath, string name, string scaffoldingPath)
            : this()
        {
            Validate.ValidateDirectoryFull(rootPath, Resources.ServiceParentDirectory);
            Validate.ValidateStringIsNullOrEmpty(name, "Name");
            Validate.ValidateFileName(name, string.Format(Resources.InvalidFileName, "Name"));
            Validate.ValidateDnsName(name, "Name");

            string newServicePath = Path.Combine(rootPath, name);
            if (Directory.Exists(newServicePath))
            {
                throw new ArgumentException(string.Format(Resources.ServiceAlreadyExistsOnDisk, name, newServicePath));
            }

            SetScaffolding(scaffoldingPath);
            Paths = new PowerShellProjectPathInfo(newServicePath);
            CreateNewService(Paths.RootPath, name);
            Components = new ServiceComponents(Paths);
            ConfigureNewService(Components, Paths, name);
        }
예제 #10
0
        public CloudServiceProject(string rootPath, string name, string scaffoldingPath)
            : this()
        {
            Validate.ValidateDirectoryFull(rootPath, Resources.ServiceParentDirectory);
            Validate.ValidateStringIsNullOrEmpty(name, "Name");
            Validate.ValidateFileName(name, string.Format(Resources.InvalidFileName, "Name"));
            Validate.ValidateDnsName(name, "Name");

            string newServicePath = Path.Combine(rootPath, name);

            if (Directory.Exists(newServicePath))
            {
                throw new ArgumentException(string.Format(Resources.ServiceAlreadyExistsOnDisk, name, newServicePath));
            }

            SetScaffolding(scaffoldingPath);
            Paths = new PowerShellProjectPathInfo(newServicePath);
            CreateNewService(Paths.RootPath, name);
            Components = new ServiceComponents(Paths);
            ConfigureNewService(Components, Paths, name);
        }
 public void ServicePathInfoTest()
 {
     PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo("MyService");
     AzureAssert.AreEqualServicePathInfo("MyService", paths);
 }
        public void SetAzureServiceProjectTestsUnknownLocation()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);
                string unknownLocation = "Unknown Location";

                settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(unknownLocation, null, null, paths.Settings);

                // Assert location is changed
                //
                Assert.Equal<string>(unknownLocation, settings.Location);
                ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings;
                Assert.Equal<string>(unknownLocation, settings.Location);
            }
        }
        public void SetAzureServiceProjectTestsSlotTestsInvalidFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows<ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, "MyHome", null, paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Slot"));
            }
        }
        public void SetAzureServiceProjectTestsSlotTests()
        {
            string[] slots = { DeploymentSlotType.Production, DeploymentSlotType.Staging };
            foreach (string item in slots)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    settings.Save(paths.Settings);

                    setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, item, null, paths.Settings);

                    // Assert slot is changed
                    //
                    settings = ServiceSettings.Load(paths.Settings);
                    Assert.Equal<string>(item, settings.Slot);
                }
            }
        }
        public void SetAzureServiceProjectTestsStorageTests()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                mockCommandRuntime = new MockCommandRuntime();
                setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime;
                settings.Save(paths.Settings);

                settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, "companystore", paths.Settings);

                // Assert storageAccountName is changed
                //
                Assert.Equal<string>("companystore", settings.StorageServiceName);
                ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings;
                Assert.Equal<string>("companystore", settings.StorageServiceName);
            }
        }
        public void ServiceComponentsTestCloudConfigDoesNotExistFail()
        {
            TestMockSupport.TestExecutionFolder = AppDomain.CurrentDomain.BaseDirectory;
            newServiceCmdlet.NewAzureServiceProcess(TestMockSupport.TestExecutionFolder, serviceName);
            PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, serviceName));

            try
            {
                File.Delete(paths.CloudConfiguration);
                ServiceComponents components = new ServiceComponents(paths);
                Assert.True(false, "No exception was thrown");
            }
            catch (Exception ex)
            {
                Assert.True(ex is FileNotFoundException);
                Assert.Equal<string>(ex.Message, string.Format(Resources.PathDoesNotExistForElement, Resources.ServiceConfiguration, paths.CloudConfiguration));
            }
        }