-
Notifications
You must be signed in to change notification settings - Fork 773
/
Copy pathBuildCommandTests.cs
584 lines (498 loc) · 25.4 KB
/
BuildCommandTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.IO.Abstractions;
using System.Text.RegularExpressions;
using Bicep.Cli.UnitTests;
using Bicep.Core;
using Bicep.Core.Configuration;
using Bicep.Core.FileSystem;
using Bicep.Core.Modules;
using Bicep.Core.Registry;
using Bicep.Core.Samples;
using Bicep.Core.UnitTests;
using Bicep.Core.UnitTests.Assertions;
using Bicep.Core.UnitTests.Mock;
using Bicep.Core.UnitTests.Registry;
using Bicep.Core.UnitTests.Utils;
using Bicep.IO.FileSystem;
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Newtonsoft.Json.Linq;
namespace Bicep.Cli.IntegrationTests
{
[TestClass]
public class BuildCommandTests : TestBase
{
[TestMethod]
public async Task Build_ZeroFiles_ShouldFail_WithExpectedErrorMessage()
{
var (output, error, result) = await Bicep("build");
using (new AssertionScope())
{
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().NotBeEmpty();
error.Should().Contain($"The input file path was not specified");
}
}
[TestMethod]
public async Task Build_NonBicepFiles_ShouldFail_WithExpectedErrorMessage()
{
var (output, error, result) = await Bicep("build", "/dev/zero");
using (new AssertionScope())
{
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().NotBeEmpty();
error.Should().Contain($@"The specified input ""/dev/zero"" was not recognized as a Bicep file. Bicep files must use the {LanguageConstants.LanguageFileExtension} extension.");
}
}
[DataTestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var clientFactory = dataSet.CreateMockRegistryClients();
var templateSpecRepositoryFactory = dataSet.CreateMockTemplateSpecRepositoryFactory(TestContext);
await dataSet.PublishModulesToRegistryAsync(clientFactory);
var bicepFilePath = Path.Combine(outputDirectory, DataSet.TestFileMain);
var settings = new InvocationSettings(new(TestContext, RegistryEnabled: dataSet.HasExternalModules), clientFactory, templateSpecRepositoryFactory);
var (output, error, result) = await Bicep(settings, "build", bicepFilePath);
using (new AssertionScope())
{
result.Should().Be(0);
output.Should().BeEmpty();
AssertNoErrors(error);
}
if (dataSet.HasExternalModules)
{
// ensure something got restored
settings.FeatureOverrides!.CacheRootDirectory!.Exists().Should().BeTrue();
Directory.EnumerateFiles(settings.FeatureOverrides.CacheRootDirectory!.Uri.GetLocalFilePath(), "*.json", SearchOption.AllDirectories).Should().NotBeEmpty();
}
var compiledFilePath = Path.Combine(outputDirectory, DataSet.TestFileMainCompiled);
File.Exists(compiledFilePath).Should().BeTrue();
var compiledFileContent = File.ReadAllText(compiledFilePath);
compiledFileContent.Should().OnlyContainLFNewline();
var actual = JToken.Parse(compiledFileContent);
actual.Should().EqualWithJsonDiffOutput(
TestContext,
JToken.Parse(dataSet.Compiled!),
expectedLocation: DataSet.GetBaselineUpdatePath(dataSet, DataSet.TestFileMainCompiled),
actualLocation: compiledFilePath);
}
[DataTestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ToStdOut_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var clientFactory = dataSet.CreateMockRegistryClients();
var templateSpecRepositoryFactory = dataSet.CreateMockTemplateSpecRepositoryFactory(TestContext);
await dataSet.PublishModulesToRegistryAsync(clientFactory);
var bicepFilePath = Path.Combine(outputDirectory, DataSet.TestFileMain);
var settings = new InvocationSettings(new(TestContext, RegistryEnabled: dataSet.HasExternalModules), clientFactory, templateSpecRepositoryFactory);
var (output, error, result) = await Bicep(settings, "build", "--stdout", bicepFilePath);
using (new AssertionScope())
{
result.Should().Be(0);
output.Should().NotBeEmpty();
output.Should().OnlyContainLFNewline();
AssertNoErrors(error);
}
if (dataSet.HasExternalModules)
{
CachedModules.GetCachedModules(BicepTestConstants.FileSystem, settings.FeatureOverrides!.CacheRootDirectory!).Should().HaveCountGreaterThan(0)
.And.AllSatisfy(m => m.Should().HaveSource());
}
var compiledFilePath = Path.Combine(outputDirectory, DataSet.TestFileMainCompiled);
File.Exists(compiledFilePath).Should().BeTrue();
var actual = JToken.Parse(output);
actual.Should().EqualWithJsonDiffOutput(
TestContext,
JToken.Parse(dataSet.Compiled!),
expectedLocation: DataSet.GetBaselineUpdatePath(dataSet, DataSet.TestFileMainCompiled),
actualLocation: compiledFilePath);
}
[DataTestMethod]
[DynamicData(nameof(GetValidDataSetsWithExternalModules), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_After_Restore_Should_Succeed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var clientFactory = dataSet.CreateMockRegistryClients();
var templateSpecRepositoryFactory = dataSet.CreateMockTemplateSpecRepositoryFactory(TestContext);
await dataSet.PublishModulesToRegistryAsync(clientFactory);
var bicepFilePath = Path.Combine(outputDirectory, DataSet.TestFileMain);
var settings = new InvocationSettings(new(TestContext, RegistryEnabled: dataSet.HasExternalModules), clientFactory, templateSpecRepositoryFactory);
var (restoreOutput, restoreError, restoreResult) = await Bicep(settings, "restore", bicepFilePath);
using (new AssertionScope())
{
restoreResult.Should().Be(0);
restoreOutput.Should().BeEmpty();
restoreError.Should().BeEmpty();
}
// run restore with the same feature settings, so it will use the mock local module cache
// but break the client to ensure no outgoing calls are made
var settingsWithBrokenClient = settings with { ClientFactory = Repository.Create<IContainerRegistryClientFactory>().Object };
var (output, error, result) = await Bicep(settingsWithBrokenClient, "build", "--stdout", "--no-restore", bicepFilePath);
using (new AssertionScope())
{
result.Should().Be(0);
output.Should().NotBeEmpty();
AssertNoErrors(error);
}
var compiledFilePath = Path.Combine(outputDirectory, DataSet.TestFileMainCompiled);
File.Exists(compiledFilePath).Should().BeTrue();
var actual = JToken.Parse(output);
actual.Should().EqualWithJsonDiffOutput(
TestContext,
JToken.Parse(dataSet.Compiled!),
expectedLocation: DataSet.GetBaselineUpdatePath(dataSet, DataSet.TestFileMainCompiled),
actualLocation: compiledFilePath);
}
[TestMethod]
public async Task Build_Valid_SingleFile_WithDigestReference_ShouldSucceed()
{
var registry = "example.com";
var registryUri = new Uri("https://" + registry);
var repository = "hello/there";
var client = new FakeRegistryBlobClient();
var clientFactory = StrictMock.Of<IContainerRegistryClientFactory>();
clientFactory.Setup(m => m.CreateAuthenticatedBlobClient(It.IsAny<CloudConfiguration>(), registryUri, repository)).Returns(client);
var templateSpecRepositoryFactory = BicepTestConstants.TemplateSpecRepositoryFactory;
var settings = new InvocationSettings(new(TestContext, RegistryEnabled: true), clientFactory.Object, BicepTestConstants.TemplateSpecRepositoryFactory);
var tempDirectory = FileHelper.GetUniqueTestOutputPath(TestContext);
Directory.CreateDirectory(tempDirectory);
var publishedBicepFilePath = Path.Combine(tempDirectory, "published.bicep");
File.WriteAllText(publishedBicepFilePath, string.Empty);
var (publishOutput, publishError, publishResult) = await Bicep(settings, "publish", publishedBicepFilePath, "--target", $"br:{registry}/{repository}:v1");
using (new AssertionScope())
{
publishResult.Should().Be(0);
publishOutput.Should().BeEmpty();
publishError.Should().BeEmpty();
}
client.Blobs.Should().HaveCount(2);
client.Manifests.Should().HaveCount(1);
client.ManifestTags.Should().HaveCount(1);
string digest = client.ModuleManifestObjects.Single().Key;
var bicep = $$"""
module empty 'br:{{registry}}/{{repository}}@{{digest}}' = {
name: 'empty'
}
""";
var bicepFilePath = Path.Combine(tempDirectory, "built.bicep");
File.WriteAllText(bicepFilePath, bicep);
var (output, error, result) = await Bicep(settings, "build", bicepFilePath);
using (new AssertionScope())
{
result.Should().Be(0);
output.Should().BeEmpty();
error.Should().BeEmpty();
}
}
[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Invalid_SingleFile_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var bicepFilePath = Path.Combine(outputDirectory, DataSet.TestFileMain);
var diagnostics = await GetAllDiagnostics(bicepFilePath, InvocationSettings.Default.ClientFactory, InvocationSettings.Default.TemplateSpecRepositoryFactory);
var (output, error, result) = await Bicep("build", bicepFilePath);
using (new AssertionScope())
{
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().ContainAll(diagnostics);
}
}
[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Invalid_SingleFile_ToStdOut_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
var bicepFilePath = Path.Combine(outputDirectory, DataSet.TestFileMain);
var (output, error, result) = await Bicep("build", "--stdout", bicepFilePath);
result.Should().Be(1);
output.Should().BeEmpty();
var diagnostics = await GetAllDiagnostics(bicepFilePath, InvocationSettings.Default.ClientFactory, InvocationSettings.Default.TemplateSpecRepositoryFactory);
error.Should().ContainAll(diagnostics);
}
[TestMethod]
public async Task Build_WithOutFile_ShouldSucceed()
{
var bicepPath = FileHelper.SaveResultFile(
TestContext,
"input.bicep",
"""
output myOutput string = 'hello!'
""");
var outputFilePath = FileHelper.GetResultFilePath(TestContext, "output.json");
File.Exists(outputFilePath).Should().BeFalse();
var (output, error, result) = await Bicep("build", "--outfile", outputFilePath, bicepPath);
File.Exists(outputFilePath).Should().BeTrue();
result.Should().Be(0);
error.Should().BeEmpty();
output.Should().BeEmpty();
}
[TestMethod]
public async Task Build_WithNonExistentOutDir_ShouldFail_WithExpectedErrorMessage()
{
var bicepPath = FileHelper.SaveResultFile(
TestContext,
"input.bicep",
"""
output myOutput string = 'hello!'
""");
var outputFileDir = FileHelper.GetResultFilePath(TestContext, "outputdir");
var (output, error, result) = await Bicep("build", "--outdir", outputFileDir, bicepPath);
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().MatchRegex(@"The specified output directory "".*outputdir"" does not exist");
}
[DataRow([])]
[DataRow(["--diagnostics-format", "defAULt"])]
[DataRow(["--diagnostics-format", "sArif"])]
[DataTestMethod]
public async Task Build_WithOutDir_ShouldSucceed(string[] args)
{
var bicepPath = FileHelper.SaveResultFile(
TestContext,
"input.bicep",
"""
output myOutput string = 'hello!'
""");
var outputFileDir = FileHelper.GetResultFilePath(TestContext, "outputdir");
Directory.CreateDirectory(outputFileDir);
var expectedOutputFile = Path.Combine(outputFileDir, "input.json");
File.Exists(expectedOutputFile).Should().BeFalse();
var (output, error, result) = await Bicep(["build", "--outdir", outputFileDir, bicepPath, .. args]);
File.Exists(expectedOutputFile).Should().BeTrue();
output.Should().BeEmpty();
if (Array.Exists(args, x => x.Equals("sarif", StringComparison.OrdinalIgnoreCase)))
{
var errorJToken = JToken.Parse(error);
var expectedErrorJToken = JToken.Parse("""
{
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.6.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "bicep"
}
},
"results": [],
"columnKind": "utf16CodeUnits"
}
]
}
""");
errorJToken.Should().EqualWithJsonDiffOutput(
TestContext,
expectedErrorJToken,
"",
"",
validateLocation: false);
}
else
{
error.Should().BeEmpty();
}
result.Should().Be(0);
}
[DataRow("DoesNotExist.bicep", new[] { "--stdout" }, @"An error occurred reading file. Could not find file '.+DoesNotExist.bicep'")]
[DataRow("DoesNotExist.bicep", new[] { "--outdir", "." }, @"An error occurred reading file. Could not find file '.+DoesNotExist.bicep'")]
[DataRow("DoesNotExist.bicep", new[] { "--outfile", "file1" }, @"An error occurred reading file. Could not find file '.+DoesNotExist.bicep'")]
[DataRow("WrongDir\\Fake.bicep", new[] { "--stdout" }, @"An error occurred reading file. Could not find .+'.+WrongDir[\\/]Fake.bicep'")]
[DataRow("WrongDir\\Fake.bicep", new[] { "--outdir", "." }, @"An error occurred reading file. Could not find .+'.+WrongDir[\\/]Fake.bicep'")]
[DataRow("WrongDir\\Fake.bicep", new[] { "--outfile", "file1" }, @"An error occurred reading file. Could not find .+'.+WrongDir[\\/]Fake.bicep'")]
[DataTestMethod]
public async Task Build_InvalidInputPaths_ShouldProduceExpectedError(string badPath, string[] args, string expectedErrorRegex)
{
var (output, error, result) = await Bicep(["build", .. args, badPath]);
result.Should().Be(1);
output.Should().BeEmpty();
}
[TestMethod]
public async Task Build_LockedOutputFile_ShouldProduceExpectedError()
{
var inputFile = FileHelper.SaveResultFile(this.TestContext, "Empty.bicep", DataSets.Empty.Bicep);
var outputFile = PathHelper.GetDefaultBuildOutputPath(inputFile);
// ReSharper disable once ConvertToUsingDeclaration
using (new FileStream(outputFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
{
// keep the output stream open while we attempt to write to it
// this should force an access denied error
var (output, error, result) = await Bicep("build", inputFile);
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().Contain("Empty.json");
}
}
[TestMethod]
public async Task Build_WithEmptyBicepConfig_ShouldProduceConfigurationError()
{
string testOutputPath = FileHelper.GetUniqueTestOutputPath(TestContext);
var inputFile = FileHelper.SaveResultFile(this.TestContext, "main.bicep", DataSets.Empty.Bicep, testOutputPath);
var configurationPath = FileHelper.SaveResultFile(this.TestContext, "bicepconfig.json", string.Empty, testOutputPath);
var (output, error, result) = await Bicep("build", inputFile);
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().StartWith($"{inputFile}(1,1) : Error BCP271: Failed to parse the contents of the Bicep configuration file \"{configurationPath}\" as valid JSON: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.");
}
[TestMethod]
public async Task Build_WithInvalidBicepConfig_ShouldProduceConfigurationError()
{
string testOutputPath = FileHelper.GetUniqueTestOutputPath(TestContext);
var inputFile = FileHelper.SaveResultFile(this.TestContext, "main.bicep", DataSets.Empty.Bicep, testOutputPath);
var configurationPath = FileHelper.SaveResultFile(
this.TestContext,
"bicepconfig.json",
"""
{
"analyzers": {
"core": {
"verbose": false,
"enabled": true,
"rules": {
"no-unused-params": {
"level": "info"
""",
testOutputPath);
var (output, error, result) = await Bicep("build", inputFile);
result.Should().Be(1);
output.Should().BeEmpty();
error.Should().StartWith($"{inputFile}(1,1) : Error BCP271: Failed to parse the contents of the Bicep configuration file \"{configurationPath}\" as valid JSON: Expected depth to be zero at the end of the JSON payload. There is an open JSON object or array that should be closed. LineNumber: 8 | BytePositionInLine: 0.");
}
[DataRow([])]
[DataRow(["--diagnostics-format", "defAULt"])]
[DataTestMethod]
public async Task Build_WithValidBicepConfig_ShouldProduceOutputFileAndExpectedError(string[] args)
{
string testOutputPath = FileHelper.GetUniqueTestOutputPath(TestContext);
var inputFile = FileHelper.SaveResultFile(this.TestContext, "main.bicep", @"param storageAccountName string = 'test'", testOutputPath);
FileHelper.SaveResultFile(
this.TestContext,
"bicepconfig.json",
"""
{
"analyzers": {
"core": {
"verbose": false,
"enabled": true,
"rules": {
"no-unused-params": {
"level": "warning"
}
}
}
}
}
""",
testOutputPath);
var expectedOutputFile = Path.Combine(testOutputPath, "main.json");
File.Exists(expectedOutputFile).Should().BeFalse();
var (output, error, result) = await Bicep(["build", "--outdir", testOutputPath, inputFile, .. args]);
File.Exists(expectedOutputFile).Should().BeTrue();
result.Should().Be(0);
output.Should().BeEmpty();
error.Should().Contain(@"main.bicep(1,7) : Warning no-unused-params: Parameter ""storageAccountName"" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]");
}
[TestMethod]
public async Task Build_WithValidBicepConfig_ShouldProduceOutputFileAndExpectedErrorInSarifFormat()
{
string testOutputPath = FileHelper.GetUniqueTestOutputPath(TestContext);
var inputFile = FileHelper.SaveResultFile(this.TestContext, "main.bicep", @"param storageAccountName string = 'test'", testOutputPath);
FileHelper.SaveResultFile(
this.TestContext,
"bicepconfig.json",
"""
{
"analyzers":{
"core":{
"verbose":false,
"enabled":true,
"rules":{
"no-unused-params":{
"level":"warning"
}
}
}
}
}
""",
testOutputPath);
var expectedOutputFile = Path.Combine(testOutputPath, "main.json");
File.Exists(expectedOutputFile).Should().BeFalse();
var (output, error, result) = await Bicep("build", "--outdir", testOutputPath, inputFile, "--diagnostics-format", "saRif");
File.Exists(expectedOutputFile).Should().BeTrue();
result.Should().Be(0);
output.Should().BeEmpty();
var errorJToken = JToken.Parse(error);
var expectedErrorJToken = JToken.Parse("""
{
"$schema":"https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.6.json",
"version":"2.1.0",
"runs":[
{
"tool":{
"driver":{
"name":"bicep"
}
},
"results":[
{
"ruleId":"no-unused-params",
"message":{
"text":"Parameter \"storageAccountName\" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]"
},
"locations":[
{
"physicalLocation":{
"artifactLocation":{
"uri":"main.bicep"
},
"region":{
"startLine":1,
"charOffset":7
}
}
}
]
}
],
"columnKind":"utf16CodeUnits"
}
]
}
""");
var selectedPath = errorJToken.SelectToken("$.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri");
selectedPath.Should().NotBeNull();
selectedPath?.Value<string>().Should().Contain("file://");
selectedPath?.Value<string>().Should().Contain("main.bicep");
selectedPath?.Replace("main.bicep");
errorJToken.Should().EqualWithJsonDiffOutput(
TestContext,
expectedErrorJToken,
"",
"",
validateLocation: false);
}
private static IEnumerable<object[]> GetValidDataSets() => DataSets
.AllDataSets
.Where(ds => ds.IsValid)
.ToDynamicTestData();
private static IEnumerable<object[]> GetInvalidDataSets() => DataSets
.AllDataSets
.Where(ds => ds.IsValid == false)
.ToDynamicTestData();
private static IEnumerable<object[]> GetValidDataSetsWithExternalModules() => DataSets
.AllDataSets
.Where(ds => ds.IsValid && ds.HasExternalModules)
.ToDynamicTestData();
}
}