Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"allowPrerelease": false,
"version": "10.0.400",
"rollForward": "latestPatch"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
26 changes: 13 additions & 13 deletions src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public async Task Build_NonBicepFiles_ShouldFail_WithExpectedErrorMessage()
}
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -101,8 +101,8 @@ public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed
actualLocation: compiledFilePath);
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ToStdOut_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -144,8 +144,8 @@ public async Task Build_Valid_SingleFile_WithTemplateSpecReference_ToStdOut_Shou
actualLocation: compiledFilePath);
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSetsWithExternalModules), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSetsWithExternalModules), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Valid_SingleFile_After_Restore_Should_Succeed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -244,8 +244,8 @@ public async Task Build_Valid_SingleFile_WithDigestReference_ShouldSucceed()
}
}

[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Invalid_SingleFile_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand All @@ -262,8 +262,8 @@ public async Task Build_Invalid_SingleFile_ShouldFail_WithExpectedErrorMessage(D
}
}

[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Build_Invalid_SingleFile_ToStdOut_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -405,7 +405,7 @@ public async Task Build_WithNonExistentOutDir_ShouldCreateOutDir()
[DataRow([])]
[DataRow(["--diagnostics-format", "defAULt"])]
[DataRow(["--diagnostics-format", "sArif"])]
[DataTestMethod]
[TestMethod]
public async Task Build_WithOutDir_ShouldSucceed(string[] args)
{
var bicepPath = FileHelper.SaveResultFile(
Expand Down Expand Up @@ -465,7 +465,7 @@ public async Task Build_WithOutDir_ShouldSucceed(string[] args)
[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]
[TestMethod]
public async Task Build_InvalidInputPaths_ShouldProduceExpectedError(string badPath, string[] args, string expectedErrorRegex)
{
var (output, error, result) = await Bicep(["build", .. args, badPath]);
Expand Down Expand Up @@ -537,7 +537,7 @@ public async Task Build_WithInvalidBicepConfig_ShouldProduceConfigurationError()

[DataRow([])]
[DataRow(["--diagnostics-format", "defAULt"])]
[DataTestMethod]
[TestMethod]
public async Task Build_WithValidBicepConfig_ShouldProduceOutputFileAndExpectedError(string[] args)
{
string testOutputPath = FileHelper.GetUniqueTestOutputPath(TestContext);
Expand Down
8 changes: 4 additions & 4 deletions src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ param objParam object
result.Stderr.Should().Contain("Error BCP033: Expected a value of type \"object\" but the provided value is of type \"'notAnObject'\".");
}

[DataTestMethod]
[TestMethod]
[BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.ValidOnly)]
[TestCategory(BaselineHelper.BaselineTestCategory)]
public async Task Build_Valid_Params_File_Should_Succeed(BaselineData_Bicepparam baselineData)
Expand All @@ -1374,7 +1374,7 @@ public async Task Build_Valid_Params_File_Should_Succeed(BaselineData_Bicepparam
data.Compiled!.ShouldHaveExpectedJsonValue();
}

[DataTestMethod]
[TestMethod]
[BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.ValidOnly)]
[TestCategory(BaselineHelper.BaselineTestCategory)]
public async Task Build_Valid_Params_File_To_Outdir_Should_Succeed(BaselineData_Bicepparam baselineData)
Expand All @@ -1395,7 +1395,7 @@ public async Task Build_Valid_Params_File_To_Outdir_Should_Succeed(BaselineData_
data.Compiled!.ShouldHaveExpectedJsonValue();
}

[DataTestMethod]
[TestMethod]
[BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.ValidOnly)]
[TestCategory(BaselineHelper.BaselineTestCategory)]
public async Task Build_Valid_Params_File_ToStdOut_Should_Succeed(BaselineData_Bicepparam baselineData)
Expand All @@ -1419,7 +1419,7 @@ public async Task Build_Valid_Params_File_ToStdOut_Should_Succeed(BaselineData_B
data.Compiled.ShouldHaveExpectedJsonValue();
}

[DataTestMethod]
[TestMethod]
[BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.InvalidOnly)]
[TestCategory(BaselineHelper.BaselineTestCategory)]
public async Task Build_Invalid_Single_Params_File_ShouldFail_WithExpectedErrorMessage(BaselineData_Bicepparam baselineData)
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Cli.IntegrationTests/DecompileCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public async Task Decompile_FileWithNoErrors_ToOutDir_ShouldSucceed()

[DataRow("DoesNotExist.json")]
[DataRow("WrongDir/Fake.json")]
[DataTestMethod]
[TestMethod]
public async Task Decompile_InvalidInputPath_ShouldFail_WithExpectedErrorMessage(string badPath)
{
badPath = Path.GetFullPath(badPath);
Expand All @@ -296,7 +296,7 @@ public async Task Decompile_InvalidInputPath_ShouldFail_WithExpectedErrorMessage

[DataRow("DoesNotExist.json")]
[DataRow("WrongDir/Fake.json")]
[DataTestMethod]
[TestMethod]
public async Task Decompile_InvalidInputPath_ToStdout_ShouldFail_WithExpectedErrorMessage(string badPath)
{
badPath = Path.GetFullPath(badPath);
Expand Down
12 changes: 6 additions & 6 deletions src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public async Task Config_ReassignsParentExamplesToChildrenAndIsNoOpForOrdinaryMo
ordinaryResult.Stdout.Should().Be("ordinary|tests/e2e/default/main.test.bicep\n");
}

[DataTestMethod]
[TestMethod]
[DataRow("""{ "output": { "file": "nested/README.md" } }""", "cannot traverse")]
[DataRow("""{ "output": { "file": "CON.md" } }""", "portable file name")]
[DataRow("""{ "output": { "file": "README.md." } }""", "portable file name")]
Expand Down Expand Up @@ -561,7 +561,7 @@ public async Task Config_MissingBicepConfigUsesBuiltInDefaults()
File.Exists(Path.Combine(root, "README.md")).Should().BeTrue();
}

[DataTestMethod]
[TestMethod]
[DataRow("{ invalid", "invalid")]
[DataRow("""{ "documentation": { "output": { "file": "../README.md" } } }""", "cannot traverse")]
public async Task Config_InvalidBicepConfigReturnsNamedError(string contents, string expectedError)
Expand Down Expand Up @@ -713,7 +713,7 @@ public async Task Output_CustomTemplateValues_MergeFilesAndIndividualValuesInCom
inlineLast.Stdout.Should().Be("last inline||two|\n");
}

[DataTestMethod]
[TestMethod]
[DataRow("[]", "must contain a JSON object")]
[DataRow("""{ "count": 1 }""", "value for \"count\" must be a string")]
[DataRow("""{ "value": null }""", "value for \"value\" must be a string")]
Expand Down Expand Up @@ -1334,7 +1334,7 @@ public async Task Generate_CompilationSetupFailure_UsesTheSelectedDiagnosticsFor
outputDocument.RootElement.ToString().Should().ContainAll("DOCS001", "compilation setup failed");
}

[DataTestMethod]
[TestMethod]
[DataRow("missing.bicep")]
[DataRow("module.txt")]
public async Task Output_InvalidInput_ReturnsNonZero(string fileName)
Expand All @@ -1355,7 +1355,7 @@ public async Task Output_InvalidInput_ReturnsNonZero(string fileName)
result.Stderr.Should().NotBeEmpty();
}

[DataTestMethod]
[TestMethod]
[DataRow(typeof(IOException))]
[DataRow(typeof(UnauthorizedAccessException))]
[DataRow(typeof(ArgumentException))]
Expand Down Expand Up @@ -1400,7 +1400,7 @@ public async Task Generate_RejectsMissingTemplateFile()
result.Stderr.Should().Contain("does not exist");
}

[DataTestMethod]
[TestMethod]
[DataRow(["docs", "generate", "main.bicep", "--custom-template-value"])]
[DataRow(["docs", "generate", "main.bicep", "--custom-template-value", "invalid"])]
[DataRow(["docs", "generate", "main.bicep", "--custom-template-value-file-path"])]
Expand Down
14 changes: 7 additions & 7 deletions src/Bicep.Cli.IntegrationTests/FormatCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task Format_WithBothOutdirAndOutfileSpecified_Fails()
[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]
[TestMethod]
public async Task Format_InvalidInputPath_Fails(string badPath, string[] args, string expectedErrorPattern)
{
var result = await Bicep(["format", .. args, badPath]);
Expand All @@ -121,7 +121,7 @@ public async Task Format_NonExistentOutDir_CreatesOutDir()
result.ExitCode.Should().Be(0);
}

[DataTestMethod]
[TestMethod]
[BaselineData_Bicepparam.TestData()]
public async Task Format_SampleBicepParam_MatchesFormattedSample(BaselineData_Bicepparam baselineData)
{
Expand All @@ -135,8 +135,8 @@ public async Task Format_SampleBicepParam_MatchesFormattedSample(BaselineData_Bi
data.Formatted.ShouldHaveExpectedValue();
}

[DataTestMethod]
[DynamicData(nameof(GetDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Format_SampleBicepFile_MatchesFormattedSample(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -248,7 +248,7 @@ public async Task Format_WithOutdir_SavesFileToOutdir()
fileSystem.FileExists("some-directory/main.bicep").Should().BeTrue();
}

[DataTestMethod]
[TestMethod]
[DataRow(true)]
[DataRow(false)]
public async Task Format_WithInsertFinalNewlineOverride_SetsFinalNewlineAccordingly(bool insertFinalNewline)
Expand Down Expand Up @@ -277,7 +277,7 @@ public async Task Format_WithInsertFinalNewlineOverride_SetsFinalNewlineAccordin
: fileContentWithoutFinalNewline);
}

[DataTestMethod]
[TestMethod]
[DataRow(IndentKind.Space)]
[DataRow(IndentKind.Tab)]
public async Task Format_WithIndentKindOverride_SetsIndentKindAccordingly(IndentKind indentKind)
Expand All @@ -304,7 +304,7 @@ public async Task Format_WithIndentKindOverride_SetsIndentKindAccordingly(Indent
formatted.Should().BeEquivalentToIgnoringNewlines(expected);
}

[DataTestMethod]
[TestMethod]
[DataRow(1)]
[DataRow(4)]
[DataRow(8)]
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Cli.IntegrationTests/InvalidArgsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task Unknown_command_should_fail_with_error()
}
}

[DataTestMethod]
[TestMethod]
// Missing input file (CommandLineException thrown from action)
[DataRow(new[] { "test" }, "The input file path was not specified")]
[DataRow(new[] { "decompile" }, "The input file path was not specified")]
Expand Down Expand Up @@ -166,7 +166,7 @@ public async Task Format_with_outdir_and_outfile_should_fail()
}
}

[DataTestMethod]
[TestMethod]
// build: --pattern conflicts
[DataRow(new[] { "build", "--stdout", "--pattern", "*.bicep" }, "The --stdout parameter cannot be used with the --pattern parameter")]
[DataRow(new[] { "build", "--outfile", "foo", "--pattern", "*.bicep" }, "The --outfile parameter cannot be used with the --pattern parameter")]
Expand Down
8 changes: 4 additions & 4 deletions src/Bicep.Cli.IntegrationTests/LintCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public async Task Lint_NonBicepFiles_ShouldFail_WithExpectedErrorMessage()
}
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSetsWithoutWarnings), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSetsWithoutWarnings), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Lint_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -130,8 +130,8 @@ public async Task Lint_Valid_SingleFile_WithDigestReference_ShouldSucceed()
}
}

[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Lint_Invalid_SingleFile_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down
14 changes: 7 additions & 7 deletions src/Bicep.Cli.IntegrationTests/PublishCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public async Task Publish_WithInvalidDocumentUri_ShouldProduceExpectedError()
error.Should().MatchRegex(@"The --documentation-uri should be a well formed uri string.");
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSetsWithDocUriAndPublishSource), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetTestDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSetsWithDocUriAndPublishSource), DynamicDataDisplayName = nameof(GetTestDisplayName))]
public async Task Publish_AllValidDataSets_ShouldSucceed(string testName, DataSet dataSet, string documentationUri, bool publishSource)
{
TestContext.WriteLine(testName);
Expand Down Expand Up @@ -248,8 +248,8 @@ public async Task Publish_AllValidDataSets_ShouldSucceed(string testName, DataSe
}
}

[DataTestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Publish_ValidArmTemplateFile_AllValidDataSets_ShouldSucceed(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand Down Expand Up @@ -393,8 +393,8 @@ public async Task Publish_AggregateExceptionWithInnerRequestFailedExceptions_Sho
}
}

[DataTestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
[TestMethod]
[DynamicData(nameof(GetInvalidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))]
public async Task Publish_InvalidFile_ShouldFail_WithExpectedErrorMessage(DataSet dataSet)
{
var outputDirectory = dataSet.SaveFilesToTestDirectory(TestContext);
Expand All @@ -415,7 +415,7 @@ public async Task Publish_InvalidFile_ShouldFail_WithExpectedErrorMessage(DataSe
}
}

[DataTestMethod]
[TestMethod]
[DataRow(
null,
"param description string",
Expand Down
Loading
Loading