@@ -20,7 +20,7 @@ InModuleScope Arcus.Scripting.ARM {
2020 }
2121 }
2222 if ([Environment ]::OSVersion.VersionString -like " *Windows*" ) {
23- It " Replaces file path with file contents as JSON object (windows)" {
23+ It " Replaces relative file path with file contents as JSON object (windows)" {
2424 # Arrange
2525 $armTemplateFile = " $PSScriptRoot \Files\arm-template-object (windows).json"
2626 try {
@@ -36,8 +36,29 @@ InModuleScope Arcus.Scripting.ARM {
3636 Get-Content $originalFile | Out-File - FilePath $armTemplateFile
3737 }
3838 }
39+ It " Replaces absolute file path with file contents as JSON object (windows)" {
40+ # Arrange
41+ $armTemplateFile = " $PSScriptRoot \Files\arm-template-object-absolutepath (windows).json"
42+ $armTemplateDirectory = Split-Path $armTemplateFile - Parent
43+ $armTemplate = Get-Content - path $armTemplateFile - Raw
44+ $armTemplate = $armTemplate -replace ' #{ArmTemplateDirectory}#' , $armTemplateDirectory
45+ $armTemplate | Set-Content - Path $armTemplateFile
46+
47+ try {
48+ # Act
49+ Inject- ArmContent - Path $armTemplateFile
50+
51+ # Assert
52+ $expected = Get-Content " $PSScriptRoot \Files\arm-template-object-value (windows).json"
53+ $actual = Get-Content $armTemplateFile
54+ $actual [7 ] | Should - Be ' "value": "{\r\n \"test\": \"this is a test value\"\r\n}",'
55+ } finally {
56+ $originalFile = " $PSScriptRoot \Files\arm-template-object-absolutepath-org (windows).json"
57+ Get-Content $originalFile | Out-File - FilePath $armTemplateFile
58+ }
59+ }
3960 } else {
40- It " Replaces file path with file contents as JSON object (linux)" {
61+ It " Replaces relative file path with file contents as JSON object (linux)" {
4162 # Arrange
4263 $armTemplateFile = " $PSScriptRoot \Files\arm-template-object (linux).json"
4364 try {
@@ -53,6 +74,27 @@ InModuleScope Arcus.Scripting.ARM {
5374 Get-Content $originalFile | Out-File - FilePath $armTemplateFile
5475 }
5576 }
77+ It " Replaces absolute file path with file contents as JSON object (linux)" {
78+ # Arrange
79+ $armTemplateFile = " $PSScriptRoot \Files\arm-template-object-absolutepath (linux).json"
80+ $armTemplateDirectory = Split-Path $armTemplateFile - Parent
81+ $armTemplate = Get-Content - path $armTemplateFile - Raw
82+ $armTemplate = $armTemplate -replace ' #{ArmTemplateDirectory}#' , $armTemplateDirectory
83+ $armTemplate | Set-Content - Path $armTemplateFile
84+
85+ try {
86+ # Act
87+ Inject- ArmContent - Path $armTemplateFile
88+
89+ # Assert
90+ $expected = Get-Content " $PSScriptRoot \Files\arm-template-object-value (linux).json"
91+ $actual = Get-Content $armTemplateFile
92+ $actual [7 ] | Should - Be ' "value": "{\n \"test\": \"this is a test value\"\n}",'
93+ } finally {
94+ $originalFile = " $PSScriptRoot \Files\arm-template-object-absolutepath-org (linux).json"
95+ Get-Content $originalFile | Out-File - FilePath $armTemplateFile
96+ }
97+ }
5698 }
5799 It " Replaces file path with file contents as escaped JSON and replaced special characters" {
58100 # Arrange
0 commit comments