コード例 #1
0
 public static void AreEqualServiceComponents(ServiceComponents actual)
 {
     Assert.IsNotNull(actual.CloudConfig);
     Assert.IsNotNull(actual.Definition);
     Assert.IsNotNull(actual.LocalConfig);
     Assert.IsNotNull(actual.Settings);
 }
コード例 #2
0
 public void ServiceComponentsTestNullPathsFail()
 {
     try
     {
         ServiceComponents components = new ServiceComponents(null as CloudProjectPathInfo);
         Assert.Fail("No exception was thrown");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is ArgumentException);
         Assert.AreEqual<string>(ex.Message, string.Format(Resources.NullObjectMessage, "paths"));
     }
 }
コード例 #3
0
        public void ServiceComponentsTestCloudConfigDoesNotExistFail()
        {
            newServiceCmdlet.NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
            PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(serviceName);

            try
            {
                File.Delete(paths.CloudConfiguration);
                ServiceComponents components = new ServiceComponents(paths);
                Assert.Fail("No exception was thrown");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is FileNotFoundException);
                Assert.AreEqual<string>(ex.Message, string.Format(Resources.PathDoesNotExistForElement, Resources.ServiceConfiguration, paths.CloudConfiguration));
            }
        }
コード例 #4
0
 public void ServiceComponentsTest()
 {
     newServiceCmdlet.NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
     ServiceComponents components = new ServiceComponents(new PowerShellProjectPathInfo(serviceName));
     AzureAssert.AreEqualServiceComponents(components);
 }
コード例 #5
0
        public static void AzureServiceExists(string serviceRootPath, string scaffoldFilePath, string serviceName, ServiceSettings settings = null, WebRoleInfo[] webRoles = null, WorkerRoleInfo[] workerRoles = null, string webScaff = null, string workerScaff = null, RoleInfo[] roles = null)
        {
            ServiceComponents components = new ServiceComponents(new ServicePathInfo(serviceRootPath));

            ScaffoldingExists(serviceRootPath, scaffoldFilePath);

            if (webRoles != null)
            {
                for (int i = 0; i < webRoles.Length; i++)
                {
                    ScaffoldingExists(Path.Combine(serviceRootPath, webRoles[i].Name), webScaff);
                }
            }

            if (workerRoles != null)
            {
                for (int i = 0; i < workerRoles.Length; i++)
                {
                    ScaffoldingExists(Path.Combine(serviceRootPath, workerRoles[i].Name), workerScaff);
                }
            }

            AreEqualServiceConfiguration(components.LocalConfig, serviceName, roles);
            AreEqualServiceConfiguration(components.CloudConfig, serviceName, roles);
            IsValidServiceDefinition(components.Definition, serviceName, webRoles, workerRoles);
            AreEqualServiceSettings(settings ?? new ServiceSettings(), components.Settings);
        }
コード例 #6
0
        public void ServiceComponentsTestSettingsDoesNotExistFail()
        {
            new NewAzureServiceProjectCommand().NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
            ServicePathInfo paths = new ServicePathInfo(serviceName);

            try
            {
                File.Delete(paths.Definition);
                ServiceComponents components = new ServiceComponents(paths);
                Assert.Fail("No exception was thrown");
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is FileNotFoundException);
                Assert.AreEqual<string>(string.Format(Resources.PathDoesNotExistForElement, Resources.ServiceDefinition, paths.Definition), ex.Message);
            }
        }
コード例 #7
0
 public void ServiceComponentsTest()
 {
     new NewAzureServiceProjectCommand().NewAzureServiceProcess(Directory.GetCurrentDirectory(), serviceName);
     ServiceComponents components = new ServiceComponents(new ServicePathInfo(serviceName));
     AzureAssert.AreEqualServiceComponents(components);
 }