|
7 | 7 | using Bicep.Core.UnitTests.Assertions;
|
8 | 8 | using Bicep.Core.UnitTests.FileSystem;
|
9 | 9 | using Bicep.Core.UnitTests.Utils;
|
| 10 | +using Bicep.TextFixtures.IO; |
10 | 11 | using Bicep.TextFixtures.Utils;
|
11 | 12 | using FluentAssertions;
|
12 | 13 | using FluentAssertions.Execution;
|
@@ -111,17 +112,15 @@ private static CompilationHelper.CompilationResult CreateLoadTextContentTestComp
|
111 | 112 | {
|
112 | 113 | var encoding = LanguageConstants.SupportedEncodings.TryGetValue(encodingName, out var val) ? val : Encoding.UTF8;
|
113 | 114 |
|
114 |
| - var files = new Dictionary<Uri, MockFileData> |
115 |
| - { |
116 |
| - [new Uri("file:///main.bicep")] = new(@" |
117 |
| -var message = loadTextContent('message.txt', '" + encodingName + @"') |
| 115 | + var fileSet = MockFileSystemTestFileSet.Create( |
| 116 | + ("main.bicep", $""" |
| 117 | + var message = loadTextContent('message.txt', '{encodingName}') |
118 | 118 |
|
119 |
| -output out string = message |
120 |
| -"), |
121 |
| - [new Uri("file:///message.txt")] = new(TEXT_CONTENT, encoding), |
122 |
| - }; |
| 119 | + output out string = message |
| 120 | + """), |
| 121 | + ("message.txt", new(TEXT_CONTENT, encoding))); |
123 | 122 |
|
124 |
| - return CompilationHelper.Compile(new(), new InMemoryFileResolver(files), files.Keys, new Uri("file:///main.bicep")); |
| 123 | + return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); |
125 | 124 | }
|
126 | 125 |
|
127 | 126 | [DataTestMethod]
|
@@ -649,15 +648,13 @@ private static CompilationHelper.CompilationResult CreateLoadJsonContentTestComp
|
649 | 648 | {
|
650 | 649 | var encoding = LanguageConstants.SupportedEncodings.TryGetValue(encodingName, out var val) ? val : Encoding.UTF8;
|
651 | 650 |
|
652 |
| - var files = new Dictionary<Uri, MockFileData> |
653 |
| - { |
654 |
| - [new Uri("file:///main.bicep")] = new(@" |
655 |
| -var fileObj = loadJsonContent('file.json', '$', '" + encodingName + @"') |
656 |
| -"), |
657 |
| - [new Uri("file:///file.json")] = new(TEST_JSON, encoding), |
658 |
| - }; |
| 651 | + var fileSet = MockFileSystemTestFileSet.Create( |
| 652 | + ("main.bicep", $""" |
| 653 | + var fileObj = loadJsonContent('file.json', '$', '{encodingName}') |
| 654 | + """), |
| 655 | + ("file.json", new(TEST_JSON, encoding))); |
659 | 656 |
|
660 |
| - return CompilationHelper.Compile(new(), new InMemoryFileResolver(files), files.Keys, new Uri("file:///main.bicep")); |
| 657 | + return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); |
661 | 658 | }
|
662 | 659 |
|
663 | 660 | [DataTestMethod]
|
@@ -995,15 +992,13 @@ private static CompilationHelper.CompilationResult CreateLoadYamlContentTestComp
|
995 | 992 | {
|
996 | 993 | var encoding = LanguageConstants.SupportedEncodings.TryGetValue(encodingName, out var val) ? val : Encoding.UTF8;
|
997 | 994 |
|
998 |
| - var files = new Dictionary<Uri, MockFileData> |
999 |
| - { |
1000 |
| - [new Uri("file:///main.bicep")] = new(@" |
1001 |
| -var fileObj = loadYamlContent('file.yaml', '$', '" + encodingName + @"') |
1002 |
| -"), |
1003 |
| - [new Uri("file:///file.yaml")] = new(TEST_YAML, encoding), |
1004 |
| - }; |
| 995 | + var fileSet = MockFileSystemTestFileSet.Create( |
| 996 | + ("main.bicep", $""" |
| 997 | + var fileObj = loadYamlContent('file.yaml', '$', '{encodingName}') |
| 998 | + """), |
| 999 | + ("file.yaml", new(TEST_YAML, encoding))); |
1005 | 1000 |
|
1006 |
| - return CompilationHelper.Compile(new(), new InMemoryFileResolver(files), files.Keys, new Uri("file:///main.bicep")); |
| 1001 | + return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); |
1007 | 1002 | }
|
1008 | 1003 |
|
1009 | 1004 | [DataTestMethod]
|
|
0 commit comments