Пример #1
0
        public void TemplateParameters()
        {
            var    templateTypes = AzureResourceGroupActionUtils.ExtractParameterTypes(template);
            string parameterJson = @"{
   ""object1"":{
      ""value"":{
         ""name"":""John""
      }
   },
   ""object2"":{
      ""value"":""#{MyObj}""
   },
   ""string"":{
      ""value"":""Hello John""
   },
   ""stringWithBadlyCaseType"":{
      ""value"":""Hello again John""
   },
   ""aSecureObject"":{
      ""value"":{""Value"":""Foo""}
   },
   ""int"":{
      ""value"":""#{MyInt}""
   },
   ""bool"":{
      ""value"":""#{MyBool}""
   },
   ""array"":{
      ""value"":""#{MyArray}""
   },
   ""int2"":{
      ""value"":55
   },
   ""bool2"":{
      ""value"":true
   },
   ""array2"":{
      ""value"":[""foo"", ""bar""]
   },
   ""complex"":{
      ""value"":""#{Complex} Smith""
   }
}";

            var variableDictionary = new TestVariableDictionary();

            variableDictionary.Set("MyObj", @"{ ""name"": ""Tim"" }");
            variableDictionary.Set("MyInt", "40");
            variableDictionary.Set("MyBool", Boolean.TrueString);
            variableDictionary.Set("MyArray", @"[ { ""points"": 67 }, { ""points"": 77 } ]");
            variableDictionary.Set("Complex", @"Hello #{if ATruthyVariable}Oliver#{else}Ella#{/if}");
            variableDictionary.Set("ATruthyVariable", Boolean.TrueString);
            var result = AzureResourceGroupActionUtils.TemplateParameters(parameterJson, templateTypes, variableDictionary);

            this.Assent(result, new Configuration().UsingNamer(new SashimiNamer()));
        }
Пример #2
0
        public void AzureCmdletsToolExcludedWhenLegacyVariableIsFalse()
        {
            var builder = Substitute.For <ICalamariCommandBuilder>();
            var context = Substitute.For <IActionHandlerContext>();

            var variables = new TestVariableDictionary();

            variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModulesLegacy, Boolean.FalseString);
            context.Variables.Returns(variables);

            builder.WithAzureTools(context, Substitute.For <ITaskLog>());
            builder.DidNotReceive().WithTool(AzureTools.AzureCmdlets);
        }
Пример #3
0
        public void AzureCmdletsToolAddedWhenBundledModulesTrue()
        {
            var builder = Substitute.For <ICalamariCommandBuilder>();
            var context = Substitute.For <IActionHandlerContext>();

            var variables = new TestVariableDictionary();

            variables.Set(SpecialVariables.Action.Azure.UseBundledAzureModules, Boolean.TrueString);
            context.Variables.Returns(variables);

            builder.WithAzureTools(context, Substitute.For <ITaskLog>());
            builder.Received().WithTool(AzureTools.AzureCmdlets);
        }