Example #1
0
        public async Task ValidateBadDeployment()
        {
            string groupName      = Recording.GenerateAssetName("csmrg");
            string deploymentName = Recording.GenerateAssetName("csmd");
            var    parameters     = new Deployment
                                    (
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                TemplateLink = new TemplateLink(BadTemplateUri),
                Parameters   = @"{ 'siteName': {'value': 'mctest0101'},'hostingPlanName': {'value': 'mctest0101'},'siteMode': {'value': 'Limited'},'computeMode': {'value': 'Shared'},'siteLocation': {'value': 'North Europe'},'sku': {'value': 'Free'},'workerSize': {'value': '0'}}".Replace("'", "\"")
            }
                                    );

            // TODO
            await ResourceGroupsOperations.CreateOrUpdateAsync(groupName, new ResourceGroup(LiveDeploymentTests.LocationWestEurope));

            try
            {
                var rawResult = await DeploymentsOperations.StartValidateAsync(groupName, deploymentName, parameters);

                var result = (await WaitForCompletionAsync(rawResult)).Value;
                Assert.NotNull(result);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.Message.Contains("InvalidTemplate"));
            }
        }
Example #2
0
        public async Task ValidateGoodDeployment()
        {
            string groupName      = Recording.GenerateAssetName("csmrg");
            string deploymentName = Recording.GenerateAssetName("csmd");
            string resourceName   = Recording.GenerateAssetName("csres");

            var parameters = new Deployment
                             (
                new DeploymentProperties(DeploymentMode.Incremental)
            {
                TemplateLink = new TemplateLink(GoodWebsiteTemplateUri),
                Parameters   = (@"{'repoURL': {'value': 'https://github.com/devigned/az-roadshow-oss.git'}, 'siteName': {'value': '" + resourceName + "'}, 'location': {'value': 'westus'}, 'sku': {'value': 'F1'}}").Replace("'", "\"")
            }
                             );

            await ResourceGroupsOperations.CreateOrUpdateAsync(groupName, new ResourceGroup(LiveDeploymentTests.LocationWestEurope));

            //Action
            var rawValidationResult = await DeploymentsOperations.StartValidateAsync(groupName, deploymentName, parameters);

            var validationResult = (await WaitForCompletionAsync(rawValidationResult)).Value;

            //Assert
            Assert.Null(validationResult.Error);
            Assert.NotNull(validationResult.Properties);
            Assert.NotNull(validationResult.Properties.Providers);
            Assert.AreEqual(1, validationResult.Properties.Providers.Count);
            Assert.AreEqual("Microsoft.Web", validationResult.Properties.Providers[0].Namespace);
        }