public void FailsAndWarnsIfAFileCannotBeParsedWhenFallbackFlagIsSet() { using (var file = new TemporaryFile(PackageBuilder.BuildSamplePackage(ServiceName, ServiceVersion))) { Variables.Set(KnownVariables.Package.EnabledFeatures, KnownVariables.Features.StructuredConfigurationVariables); Variables.AddFlag(ActionVariables.StructuredConfigurationFallbackFlag, true); Variables.Set(ActionVariables.StructuredConfigurationVariablesTargets, MalformedFileName); Variables.Set("key", "new-value"); var result = DeployPackage(file.FilePath); result.AssertFailure(); result.AssertErrorOutput("The file could not be parsed as Json"); } }
public void ShouldNotTreatYamlFileAsYamlWhenFallbackFlagIsSet() { using (var file = new TemporaryFile(PackageBuilder.BuildSamplePackage(ServiceName, ServiceVersion))) { Variables.Set(KnownVariables.Package.EnabledFeatures, KnownVariables.Features.StructuredConfigurationVariables); Variables.AddFlag(ActionVariables.StructuredConfigurationFallbackFlag, true); Variables.Set(ActionVariables.StructuredConfigurationVariablesTargets, YamlFileName); Variables.Set("key", "new-value"); var result = DeployPackage(file.FilePath); result.AssertFailure(); // Indicates we tried to parse yaml as JSON. result.AssertErrorOutput("The file could not be parsed as Json"); } }
public override void SetupProject(Variables.Root variables) { base.SetupProject(variables); variables.AddFlag(Key); variables.AddStateObject(stateOwner, new State()); }