diff --git a/global.json b/global.json index e02786dcdec..2a62ee25953 100644 --- a/global.json +++ b/global.json @@ -6,5 +6,8 @@ "allowPrerelease": false, "version": "10.0.400", "rollForward": "latestPatch" + }, + "test": { + "runner": "Microsoft.Testing.Platform" } } diff --git a/src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs b/src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs index 39bd0bd1d2a..bcb233077ed 100644 --- a/src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/BuildCommandTests.cs @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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( @@ -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]); @@ -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); diff --git a/src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs b/src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs index 4963a4085b8..07eebccc42b 100644 --- a/src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/src/Bicep.Cli.IntegrationTests/DecompileCommandTests.cs b/src/Bicep.Cli.IntegrationTests/DecompileCommandTests.cs index 62683a6e8c4..3087bebd2ea 100644 --- a/src/Bicep.Cli.IntegrationTests/DecompileCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/DecompileCommandTests.cs @@ -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); @@ -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); diff --git a/src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs b/src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs index 4d3f6c1c903..686e0494e61 100644 --- a/src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/DocsCommandTests.cs @@ -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")] @@ -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) @@ -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")] @@ -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) @@ -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))] @@ -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"])] diff --git a/src/Bicep.Cli.IntegrationTests/FormatCommandTests.cs b/src/Bicep.Cli.IntegrationTests/FormatCommandTests.cs index 41d71d28c30..33804ff4d32 100644 --- a/src/Bicep.Cli.IntegrationTests/FormatCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/FormatCommandTests.cs @@ -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]); @@ -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) { @@ -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); @@ -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) @@ -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) @@ -304,7 +304,7 @@ public async Task Format_WithIndentKindOverride_SetsIndentKindAccordingly(Indent formatted.Should().BeEquivalentToIgnoringNewlines(expected); } - [DataTestMethod] + [TestMethod] [DataRow(1)] [DataRow(4)] [DataRow(8)] diff --git a/src/Bicep.Cli.IntegrationTests/InvalidArgsTests.cs b/src/Bicep.Cli.IntegrationTests/InvalidArgsTests.cs index e66c166ec20..d490f2f117d 100644 --- a/src/Bicep.Cli.IntegrationTests/InvalidArgsTests.cs +++ b/src/Bicep.Cli.IntegrationTests/InvalidArgsTests.cs @@ -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")] @@ -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")] diff --git a/src/Bicep.Cli.IntegrationTests/LintCommandTests.cs b/src/Bicep.Cli.IntegrationTests/LintCommandTests.cs index a43de486022..8fad7219d25 100644 --- a/src/Bicep.Cli.IntegrationTests/LintCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/LintCommandTests.cs @@ -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); @@ -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); diff --git a/src/Bicep.Cli.IntegrationTests/PublishCommandTests.cs b/src/Bicep.Cli.IntegrationTests/PublishCommandTests.cs index 6967f0dc996..27c2a009913 100644 --- a/src/Bicep.Cli.IntegrationTests/PublishCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/PublishCommandTests.cs @@ -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); @@ -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); @@ -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); @@ -415,7 +415,7 @@ public async Task Publish_InvalidFile_ShouldFail_WithExpectedErrorMessage(DataSe } } - [DataTestMethod] + [TestMethod] [DataRow( null, "param description string", diff --git a/src/Bicep.Cli.IntegrationTests/RestoreCommandTests.cs b/src/Bicep.Cli.IntegrationTests/RestoreCommandTests.cs index 678b61afaa2..1bcbbaabbb1 100644 --- a/src/Bicep.Cli.IntegrationTests/RestoreCommandTests.cs +++ b/src/Bicep.Cli.IntegrationTests/RestoreCommandTests.cs @@ -47,7 +47,7 @@ public async Task Restore_ZeroFiles_ShouldFail_WithExpectedErrorMessage() } [TestMethod] - [DynamicData(nameof(GetAllDataSetsWithPublishSource), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetAllDataSetsWithPublishSource))] public async Task Restore_ShouldSucceed(string testName, DataSet dataSet, bool publishSource) { TestContext.WriteLine(testName); @@ -159,8 +159,8 @@ public async Task Restore_should_succeed_for_bicepparam_file_with_registry_refer .And.AllSatisfy(m => m.Should().NotHaveSource()); } - [DataTestMethod] - [DynamicData(nameof(GetAllDataSetsWithPublishSource), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetAllDataSetsWithPublishSource))] public async Task Restore_ShouldSucceedWithAnonymousClient(string testName, DataSet dataSet, bool publishSource) { TestContext.WriteLine(testName); @@ -214,7 +214,7 @@ public async Task Restore_ShouldSucceedWithAnonymousClient(string testName, Data // // // No errors - [DataTestMethod] + [TestMethod] [DataRow(null, null, null)] [DataRow(null, "application/vnd.ms.bicep.module.artifact", null)] [DataRow("application/vnd.oci.image.manifest.v1+json", null, null)] @@ -281,7 +281,7 @@ public async Task Restore_Artifacts_BackwardsAndForwardsCompatibility(string? me } } - [DataTestMethod] + [TestMethod] // *** Valid Cases *** [DataRow(new string[] { BicepMediaTypes.BicepModuleLayerV1Json }, null)] [DataRow(new string[] { "unknown1", "unknown2", BicepMediaTypes.BicepModuleLayerV1Json }, null)] @@ -483,7 +483,7 @@ param p2 string } } - [DataTestMethod] + [TestMethod] [DataRow(false)] [DataRow(true)] public async Task Restore_ByDigest_ShouldSucceed(bool publishSource) @@ -539,8 +539,8 @@ public async Task Restore_ByDigest_ShouldSucceed(bool publishSource) } } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSetsWithExternalModulesAndPublishSource), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetValidDataSetsWithExternalModulesAndPublishSource))] public async Task Restore_NonExistentModules_ShouldFail(string testName, DataSet dataSet, bool publishSource) { var clientFactory = dataSet.CreateMockRegistryClients(); diff --git a/src/Bicep.Core.IntegrationTests/AzTypesViaRegistryTests.cs b/src/Bicep.Core.IntegrationTests/AzTypesViaRegistryTests.cs index 8cbd1412ce5..59ed28d2a75 100644 --- a/src/Bicep.Core.IntegrationTests/AzTypesViaRegistryTests.cs +++ b/src/Bicep.Core.IntegrationTests/AzTypesViaRegistryTests.cs @@ -100,7 +100,7 @@ await RegistryHelper.PublishModuleToRegistryAsync( } [TestMethod] - [DynamicData(nameof(ArtifactRegistryCorruptedPackageNegativeTestScenarios), DynamicDataSourceType.Method)] + [DynamicData(nameof(ArtifactRegistryCorruptedPackageNegativeTestScenarios))] public async Task Bicep_compiler_handles_corrupted_extension_package_gracefully( BinaryData payload, string innerErrorMessage) @@ -132,7 +132,7 @@ public record ArtifactRegistryAddress(string RegistryAddress, string RepositoryP } [TestMethod] - [DynamicData(nameof(ArtifactRegistryAddressNegativeTestScenarios), DynamicDataSourceType.Method)] + [DynamicData(nameof(ArtifactRegistryAddressNegativeTestScenarios))] public async Task Repository_not_found_in_registry( ArtifactRegistryAddress artifactRegistryAddress, Exception exceptionToThrow, diff --git a/src/Bicep.Core.IntegrationTests/DirectResourceCollectionTests.cs b/src/Bicep.Core.IntegrationTests/DirectResourceCollectionTests.cs index 27f819a0fc6..b6cb37c23cf 100644 --- a/src/Bicep.Core.IntegrationTests/DirectResourceCollectionTests.cs +++ b/src/Bicep.Core.IntegrationTests/DirectResourceCollectionTests.cs @@ -119,7 +119,7 @@ public void DirectResourceCollectionAccess_Modules() "[join(map(references('multiModules'), lambda('m', lambdaVariables('m').outputs.modOutput1.value)), ',')]"); } - [DataTestMethod] + [TestMethod] [DataRow(""" var loopVar = [for i in range(0, 2): { prop: map(containerWorkers, (w) => w.properties.ipAddress.ip) diff --git a/src/Bicep.Core.IntegrationTests/Emit/DependencyInferenceTests.cs b/src/Bicep.Core.IntegrationTests/Emit/DependencyInferenceTests.cs index a38fb1b5014..aacd4338ae8 100644 --- a/src/Bicep.Core.IntegrationTests/Emit/DependencyInferenceTests.cs +++ b/src/Bicep.Core.IntegrationTests/Emit/DependencyInferenceTests.cs @@ -206,7 +206,7 @@ public void Implicit_dependencies_on_deployed_resource_identifying_properties_ar result.Template.Should().HaveJsonAtPath("$.resources.secondDeployedSa.dependsOn", """["deployedSa"]"""); } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Implicit_dependencies_on_existing_resource_identifying_properties_are_expressed_as_direct_dependencies_on_transitive_dependencies_in_symbolic_name_template(bool useArrayAccess) @@ -245,7 +245,7 @@ public void Implicit_dependencies_on_existing_resource_identifying_properties_ar result.Template.Should().HaveJsonAtPath("$.resources.existingSa.dependsOn", """["deployedSa"]"""); } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Implicit_dependencies_on_existing_resource_collection_identifying_properties_are_expressed_as_direct_dependencies_on_transitive_dependencies_in_symbolic_name_template(bool useArrayAccess) @@ -398,7 +398,7 @@ public void Using_an_existing_resource_as_an_explicit_parent_does_not_generate_a result.Template.Should().NotHaveValueAtPath("$.resources.sa.dependsOn"); } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Non_looped_resource_depending_on_looped_existing_resource_should_depend_on_transitive_resource_collections(bool useSymbolicNameCodegen) @@ -445,7 +445,7 @@ public void Non_looped_resource_depending_on_looped_existing_resource_should_dep } } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Looped_resource_depending_on_looped_existing_resource_should_depend_on_transitive_resource_element(bool useSymbolicNameCodegen) @@ -496,7 +496,7 @@ public void Looped_resource_depending_on_looped_existing_resource_should_depend_ } } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Looped_resource_depending_on_looped_variable_should_depend_on_transitive_resource_element(bool useSymbolicNameCodegen) @@ -549,7 +549,7 @@ public void Looped_resource_depending_on_looped_variable_should_depend_on_transi } } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void CopyIndex_only_appears_in_compiled_expression_if_all_links_in_chain_use_a_loop_variable_reference(bool useSymbolicNameCodegen) @@ -598,7 +598,7 @@ public void CopyIndex_only_appears_in_compiled_expression_if_all_links_in_chain_ } } - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void CopyIndex_only_appears_in_compiled_expression_if_all_links_in_chain_use_a_loop_variable_reference_2(bool useSymbolicNameCodegen) diff --git a/src/Bicep.Core.IntegrationTests/Emit/ParamsFileWriterTests.cs b/src/Bicep.Core.IntegrationTests/Emit/ParamsFileWriterTests.cs index e888dc71130..7bcbb8fbf72 100644 --- a/src/Bicep.Core.IntegrationTests/Emit/ParamsFileWriterTests.cs +++ b/src/Bicep.Core.IntegrationTests/Emit/ParamsFileWriterTests.cs @@ -11,7 +11,7 @@ namespace Bicep.Core.IntegrationTests.Emit [TestClass] public class ParamsFileWriterTests { - [DataTestMethod] + [TestMethod] [DataRow(@" using 'main.bicep' diff --git a/src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs b/src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs index 99e59b404de..6f9fd41a963 100644 --- a/src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs +++ b/src/Bicep.Core.IntegrationTests/Emit/TemplateEmitterTests.cs @@ -75,8 +75,8 @@ private async Task GetCompilation(BaselineData_Bicepparam baseline, return await compiler.CreateCompilation(baseline.GetData(TestContext).Parameters.OutputFileUri.ToIOUri()); } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ValidBicep_TemplateEmiterShouldProduceExpectedTemplate(DataSet dataSet) { @@ -101,8 +101,8 @@ public async Task ValidBicep_TemplateEmiterShouldProduceExpectedTemplate(DataSet UnitTests.Utils.TemplateHelper.TemplateShouldBeValid(outputFile, result.Features!); } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ValidBicep_EmitTemplate_should_produce_expected_symbolicname_template(DataSet dataSet) { @@ -127,7 +127,7 @@ public async Task ValidBicep_EmitTemplate_should_produce_expected_symbolicname_t UnitTests.Utils.TemplateHelper.TemplateShouldBeValid(outputFile, result.Features!); } - [DataTestMethod] + [TestMethod] [EmbeddedFilesTestData(@"Files/SourceMapping/.*/main.bicep")] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task Source_map_generation_should_work(EmbeddedFile file) @@ -154,8 +154,8 @@ public async Task Source_map_generation_should_work(EmbeddedFile file) sourceMapFile.ShouldHaveExpectedJsonValue(); } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task SourceMap_maps_json_to_bicep_lines(DataSet dataSet) { @@ -203,8 +203,8 @@ public void TemplateEmitter_output_should_not_include_UTF8_BOM() bytes.Last().Should().Be(0x7D, "template should always end with a UTF-8 encoded close curly"); } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ValidBicepTextWriter_TemplateEmiterShouldProduceExpectedTemplate(DataSet dataSet) { @@ -227,8 +227,8 @@ public async Task ValidBicepTextWriter_TemplateEmiterShouldProduceExpectedTempla actualLocation: compiledFilePath); } - [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 InvalidBicep_TemplateEmiterShouldNotProduceAnyTemplate(DataSet dataSet) { var compilation = await GetCompilation(dataSet, new(TestContext)); @@ -240,7 +240,7 @@ public async Task InvalidBicep_TemplateEmiterShouldNotProduceAnyTemplate(DataSet result.Status.Should().Be(EmitStatus.Failed); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.ValidOnly)] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task Valid_bicepparam_TemplateEmiter_should_produce_expected_template(BaselineData_Bicepparam baselineData) @@ -258,7 +258,7 @@ public async Task Valid_bicepparam_TemplateEmiter_should_produce_expected_templa data.Compiled.ShouldHaveExpectedJsonValue(); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData(Filter = BaselineData_Bicepparam.TestDataFilterType.InvalidOnly)] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task Invalid_bicepparam_TemplateEmiter_should_not_produce_a_template(BaselineData_Bicepparam baselineData) @@ -273,7 +273,7 @@ public async Task Invalid_bicepparam_TemplateEmiter_should_not_produce_a_templat result.Status.Should().Be(EmitStatus.Failed); } - [DataTestMethod] + [TestMethod] [DataRow("\n")] [DataRow("\r\n")] public void Multiline_strings_should_parse_correctly(string newlineSequence) diff --git a/src/Bicep.Core.IntegrationTests/ExamplesTests.cs b/src/Bicep.Core.IntegrationTests/ExamplesTests.cs index 49822d71d35..425a91e6857 100644 --- a/src/Bicep.Core.IntegrationTests/ExamplesTests.cs +++ b/src/Bicep.Core.IntegrationTests/ExamplesTests.cs @@ -69,20 +69,20 @@ public static async Task RunExampleTest(TestContext testContext, EmbeddedFile em } } - [DataTestMethod] - [DynamicData(nameof(GetAllExampleData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetAllExampleData))] [TestCategory(BaselineHelper.BaselineTestCategory)] public Task ExampleIsValid(EmbeddedFile embeddedBicep) => RunExampleTest(TestContext, embeddedBicep, new(TestContext), ".json"); - [DataTestMethod] - [DynamicData(nameof(GetAllExampleData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetAllExampleData))] [TestCategory(BaselineHelper.BaselineTestCategory)] public Task ExampleIsValid_using_experimental_symbolic_names(EmbeddedFile embeddedBicep) => RunExampleTest(TestContext, embeddedBicep, new(TestContext, SymbolicNameCodegenEnabled: true), ".symbolicnames.json"); - [DataTestMethod] - [DynamicData(nameof(GetAllExampleData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetAllExampleData))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Example_uses_consistent_formatting(EmbeddedFile embeddedBicep) { diff --git a/src/Bicep.Core.IntegrationTests/ExtensibilityTests.cs b/src/Bicep.Core.IntegrationTests/ExtensibilityTests.cs index a41b83cf018..b78134165e5 100644 --- a/src/Bicep.Core.IntegrationTests/ExtensibilityTests.cs +++ b/src/Bicep.Core.IntegrationTests/ExtensibilityTests.cs @@ -577,7 +577,7 @@ extension foo as foo result.Template.Should().HaveValueAtPath("$.resources.myApp.extension", "foo"); } - [DataTestMethod] + [TestMethod] [DataRow( "InlineValues", "{ kubeConfig: 'fromModule', namespace: 'other' }", null)] [DataRow( @@ -641,7 +641,7 @@ extension kubernetes compilation.Should().NotHaveAnyDiagnostics_WithAssertionScoping(d => d.IsError()); } - [DataTestMethod] + [TestMethod] [DataRow( "MissingExtensionConfigs", "extension kubernetes", @@ -743,7 +743,7 @@ param inputa string compilation.Should().ContainSingleDiagnostic(expectedDiagnosticCode, DiagnosticLevel.Error, expectedDiagnosticMessage); } - [DataTestMethod] + [TestMethod] [DataRow( "ParamsFile", "BCP337", @@ -821,7 +821,7 @@ extension kubernetes } } - [DataTestMethod] + [TestMethod] [DataRow( "FullInheritance", "extensionConfigs: { kubernetes: k8s.config }", @@ -895,7 +895,7 @@ extension kubernetes .DeepEqual(JToken.Parse(expectedExtConfigJson)); } - [DataTestMethod] + [TestMethod] [DataRow( "NoneRequired", "", @@ -955,7 +955,7 @@ param inputa string compilation.Should().NotHaveAnyDiagnostics_WithAssertionScoping(d => d.IsError()); } - [DataTestMethod] + [TestMethod] [DataRow( "IncompleteSyntax_ToAlias", "extensionConfig k8s", diff --git a/src/Bicep.Core.IntegrationTests/ExtensionRegistryTests.cs b/src/Bicep.Core.IntegrationTests/ExtensionRegistryTests.cs index ff6eeecba55..40773bd332e 100644 --- a/src/Bicep.Core.IntegrationTests/ExtensionRegistryTests.cs +++ b/src/Bicep.Core.IntegrationTests/ExtensionRegistryTests.cs @@ -49,7 +49,7 @@ public void Http_extension_can_be_generated(EmbeddedFile indexJson) } } - [DataTestMethod] + [TestMethod] [DataRow(false, "", false)] [DataRow(false, "as fooExt", false)] [DataRow(true, "", true)] @@ -94,7 +94,7 @@ public async Task Extensions_published_to_a_registry_can_be_compiled(bool module result.Template.Should().NotBeNull(); } - [DataTestMethod] + [TestMethod] [DataRow(false, "", false)] [DataRow(false, "as fooExt", false)] [DataRow(true, "", true)] diff --git a/src/Bicep.Core.IntegrationTests/LexerTests.cs b/src/Bicep.Core.IntegrationTests/LexerTests.cs index 314dc6d99df..d46b1c4f60c 100644 --- a/src/Bicep.Core.IntegrationTests/LexerTests.cs +++ b/src/Bicep.Core.IntegrationTests/LexerTests.cs @@ -21,8 +21,8 @@ public class LexerTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void LexerShouldRoundtrip(DataSet dataSet) { var lexer = new Lexer(new SlidingTextWindow(dataSet.Bicep), ToListDiagnosticWriter.Create()); @@ -34,8 +34,8 @@ public void LexerShouldRoundtrip(DataSet dataSet) serialized.ToString().Should().Be(dataSet.Bicep, "because the lexer should not lose information"); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void LexerShouldProduceValidTokenLocations(DataSet dataSet) { var lexer = new Lexer(new SlidingTextWindow(dataSet.Bicep), ToListDiagnosticWriter.Create()); @@ -50,8 +50,8 @@ public void LexerShouldProduceValidTokenLocations(DataSet dataSet) } } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void LexerShouldProduceContiguousSpans(DataSet dataSet) { var lexer = new Lexer(new SlidingTextWindow(dataSet.Bicep), ToListDiagnosticWriter.Create()); @@ -90,8 +90,8 @@ void VisitTrivia(IEnumerable trivia) visitedPosition.Should().Be(dataSet.Bicep.Length); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void LexerShouldProduceExpectedTokens(DataSet dataSet) { @@ -116,7 +116,7 @@ string getLoggingString(Token token) lexer.GetTokens().Last().Type.Should().Be(TokenType.EndOfFile, "because the last token should always be EOF."); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public void ParamsFile_LexerShouldProduceExpectedTokens(BaselineData_Bicepparam baselineData) @@ -140,8 +140,8 @@ string getLoggingString(Token token) lexer.GetTokens().Last().Type.Should().Be(TokenType.EndOfFile, "because the last token should always be EOF."); } - [DataTestMethod] - [DynamicData(nameof(GetValidData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void LexerShouldProduceValidStringLiteralTokensOnValidFiles(DataSet dataSet) { if (dataSet.Name != "Metadata_CRLF") diff --git a/src/Bicep.Core.IntegrationTests/ModuleTests.cs b/src/Bicep.Core.IntegrationTests/ModuleTests.cs index 9065b73c0da..7e89967ce6d 100644 --- a/src/Bicep.Core.IntegrationTests/ModuleTests.cs +++ b/src/Bicep.Core.IntegrationTests/ModuleTests.cs @@ -484,7 +484,7 @@ param p resource 'Microsoft.Storage/storageAccounts@2021-04-01' // Regression test for https://github.com/Azure/bicep/issues/6038 // // Object-typed parameters should work the same way regardless of whether resource-typed parameters are enabled. - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Module_can_pass_resource_body_as_object_typed_parameter(bool enableResourceTypeParameters) @@ -704,7 +704,7 @@ public void Module_cannot_reference_bicep_params_file() [DataRow("this______has_________fifty_____________characters", "this______has_________fifty_____________characters")] [DataRow("this______has_________fifty_one__________characters", "this______has_________fifty_one__________character")] [DataRow("module_symbolic_name_with_a_super_long_name_that_has_seventy_seven_characters", "module_symbolic_name_with_a_super_long_name_that_h")] - [DataTestMethod] + [TestMethod] public void Module_name_is_generated_correctly_when_optional_module_names_enabled(string symbolicName, string symbolicNamePrefix) { var services = new ServiceBuilder().WithFeatureOverrides(new FeatureProviderOverrides(TestContext)); @@ -725,7 +725,7 @@ public void Module_name_is_generated_correctly_when_optional_module_names_enable [DataRow("this______has_______forty_six_______characters", "this______has_______forty_six_______characters")] [DataRow("this______has_______forty_seven______characters", "this______has_______forty_seven______character")] [DataRow("module_symbolic_name_with_a_super_long_name_that_has_seventy_seven_characters", "module_symbolic_name_with_a_super_long_name_th")] - [DataTestMethod] + [TestMethod] public void Module_collection_name_is_generated_correctly_when_optional_module_names_enabled(string symbolicName, string symbolicNamePrefix) { var services = new ServiceBuilder().WithFeatureOverrides(new FeatureProviderOverrides(TestContext)); @@ -747,7 +747,7 @@ public void Module_collection_name_is_generated_correctly_when_optional_module_n [DataRow("this______has_________fifty_____________characters", "this______has_________fifty_____________characters")] [DataRow("this______has_________fifty_one__________characters", "this______has_________fifty_one__________character")] [DataRow("module_symbolic_name_with_a_super_long_name_that_has_seventy_seven_characters", "module_symbolic_name_with_a_super_long_name_that_h")] - [DataTestMethod] + [TestMethod] public void Module_with_generated_name_can_be_referenced_correctly(string symbolicName, string symbolicNamePrefix) { var services = new ServiceBuilder().WithFeatureOverrides(new FeatureProviderOverrides(TestContext)); @@ -769,7 +769,7 @@ public void Module_with_generated_name_can_be_referenced_correctly(string symbol [DataRow("this______has_______forty_six_______characters", "this______has_______forty_six_______characters")] [DataRow("this______has_______forty_seven______characters", "this______has_______forty_seven______character")] [DataRow("module_symbolic_name_with_a_super_long_name_that_has_seventy_seven_characters", "module_symbolic_name_with_a_super_long_name_th")] - [DataTestMethod] + [TestMethod] public void Module_collection_with_generated_name_can_be_referenced_correctly(string symbolicName, string symbolicNamePrefix) { var services = new ServiceBuilder().WithFeatureOverrides(new FeatureProviderOverrides(TestContext)); diff --git a/src/Bicep.Core.IntegrationTests/MsGraphTypesViaRegistryTests.cs b/src/Bicep.Core.IntegrationTests/MsGraphTypesViaRegistryTests.cs index 21033a5ed1c..5dc9f1f6be7 100644 --- a/src/Bicep.Core.IntegrationTests/MsGraphTypesViaRegistryTests.cs +++ b/src/Bicep.Core.IntegrationTests/MsGraphTypesViaRegistryTests.cs @@ -45,7 +45,7 @@ private async Task ServicesWithTestExtensionArtifact(ArtifactReg } [TestMethod] - [DynamicData(nameof(ArtifactRegistryCorruptedPackageNegativeTestScenarios), DynamicDataSourceType.Method)] + [DynamicData(nameof(ArtifactRegistryCorruptedPackageNegativeTestScenarios))] public async Task Bicep_compiler_handles_corrupted_extension_package_gracefully( BinaryData payload, string innerErrorMessage) @@ -77,7 +77,7 @@ public record ArtifactRegistryAddress(string RegistryAddress, string RepositoryP } [TestMethod] - [DynamicData(nameof(ArtifactRegistryAddressNegativeTestScenarios), DynamicDataSourceType.Method)] + [DynamicData(nameof(ArtifactRegistryAddressNegativeTestScenarios))] public async Task Repository_not_found_in_registry( ArtifactRegistryAddress artifactRegistryAddress, Exception exceptionToThrow, diff --git a/src/Bicep.Core.IntegrationTests/NestedResourceTests.cs b/src/Bicep.Core.IntegrationTests/NestedResourceTests.cs index 689ae22cd40..64739543139 100644 --- a/src/Bicep.Core.IntegrationTests/NestedResourceTests.cs +++ b/src/Bicep.Core.IntegrationTests/NestedResourceTests.cs @@ -748,7 +748,7 @@ public void Nested_resource_formats_references_correctly_for_existing_resources( } } - [DataTestMethod] + [TestMethod] [DataRow("resourceGroup('other')")] [DataRow("subscription()")] [DataRow("managementGroup('abcdef')")] diff --git a/src/Bicep.Core.IntegrationTests/OutputsTests.cs b/src/Bicep.Core.IntegrationTests/OutputsTests.cs index a99d0106903..d0f733d7ec6 100644 --- a/src/Bicep.Core.IntegrationTests/OutputsTests.cs +++ b/src/Bicep.Core.IntegrationTests/OutputsTests.cs @@ -120,7 +120,7 @@ public void Output_can_have_specified_resource_type() } // Object-typed outputs should work the same way regardless of whether resource-typed outputs are enabled. - [DataTestMethod] + [TestMethod] [DataRow(true)] [DataRow(false)] public void Output_can_have_object_type(bool enableResourceTypeParameters) diff --git a/src/Bicep.Core.IntegrationTests/ParameterFileTests.cs b/src/Bicep.Core.IntegrationTests/ParameterFileTests.cs index 9e1cec39bdc..c8aa7349e18 100644 --- a/src/Bicep.Core.IntegrationTests/ParameterFileTests.cs +++ b/src/Bicep.Core.IntegrationTests/ParameterFileTests.cs @@ -692,7 +692,7 @@ public void ImportedVariable_WithoutResourceGroupInResourceId_ReturnsDiagnostic( "The imported symbol \"subnetId\" cannot be used in a .bicepparam file because it depends on deployment-context functions: \"resourceId\". Imported declarations may only use functions that can be evaluated while building the parameters file."); } - [DataTestMethod] + [TestMethod] [DataRow("subscriptionResourceId('aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee', 'Microsoft.Authorization/roleDefinitions', 'role')")] [DataRow("managementGroupResourceId('managementGroup', 'Microsoft.Authorization/policyDefinitions', 'policy')")] [DataRow("tenantResourceId('Microsoft.Authorization/policyDefinitions', 'policy')")] @@ -714,7 +714,7 @@ public void ImportedVariable_WithContextIndependentResourceIdFunction_Compiles(s result.Should().NotHaveAnyDiagnostics(); } - [DataTestMethod] + [TestMethod] [DataRow("subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'role')", "subscriptionResourceId")] [DataRow("managementGroupResourceId('Microsoft.Authorization/policyDefinitions', 'policy')", "managementGroupResourceId")] public void ImportedVariable_WithContextDependentResourceIdFunction_ReturnsDiagnostic(string functionCall, string functionName) @@ -735,7 +735,7 @@ public void ImportedVariable_WithContextDependentResourceIdFunction_ReturnsDiagn $"The imported symbol \"resourceIdValue\" cannot be used in a .bicepparam file because it depends on deployment-context functions: \"{functionName}\". Imported declarations may only use functions that can be evaluated while building the parameters file."); } - [DataTestMethod] + [TestMethod] [DataRow("extensionResourceId(resourceId('Microsoft.Storage/storageAccounts', 'storage'), 'Microsoft.Authorization/locks', 'lock')", "resourceId")] [DataRow("tenantResourceId('Microsoft.Authorization/policyDefinitions', resourceGroup().name)", "resourceGroup")] public void ImportedVariable_WithPureResourceIdFunctionWrappingContextDependentFunction_ReturnsDiagnostic(string functionCall, string functionName) diff --git a/src/Bicep.Core.IntegrationTests/ParentPropertyResourceTests.cs b/src/Bicep.Core.IntegrationTests/ParentPropertyResourceTests.cs index 86358d566d0..0cecbebc8a6 100644 --- a/src/Bicep.Core.IntegrationTests/ParentPropertyResourceTests.cs +++ b/src/Bicep.Core.IntegrationTests/ParentPropertyResourceTests.cs @@ -231,7 +231,7 @@ public void Parent_property_formats_references_correctly_for_existing_resources( } } - [DataTestMethod] + [TestMethod] [DataRow("resourceGroup('other')")] [DataRow("subscription()")] [DataRow("managementGroup('abcdef')")] diff --git a/src/Bicep.Core.IntegrationTests/ParserTests.cs b/src/Bicep.Core.IntegrationTests/ParserTests.cs index ac76876502d..10e27f13b86 100644 --- a/src/Bicep.Core.IntegrationTests/ParserTests.cs +++ b/src/Bicep.Core.IntegrationTests/ParserTests.cs @@ -21,21 +21,21 @@ public class ParserTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void FilesShouldRoundTripSuccessfully(DataSet dataSet) { RunRoundTripTest(dataSet.Bicep); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void FileTreeNodesShouldHaveConsistentSpans(DataSet dataSet) { RunSpanConsistencyTest(dataSet.Bicep); } - [DataTestMethod] + [TestMethod] [DataRow("")] [DataRow("param")] [DataRow("param\r\n")] @@ -50,8 +50,8 @@ public void Oneliners_ShouldRoundTripSuccessfully(string contents) RunSpanConsistencyTest(contents); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Parser_should_produce_expected_syntax(DataSet dataSet) { @@ -71,7 +71,7 @@ public void Parser_should_produce_expected_syntax(DataSet dataSet) actualPath: resultsFile); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Params_Parser_should_produce_expected_syntax(BaselineData_Bicepparam baselineData) diff --git a/src/Bicep.Core.IntegrationTests/PrettyPrint/PrettyPrinterV2Tests.cs b/src/Bicep.Core.IntegrationTests/PrettyPrint/PrettyPrinterV2Tests.cs index 9e008a2a36a..842206a9d8d 100644 --- a/src/Bicep.Core.IntegrationTests/PrettyPrint/PrettyPrinterV2Tests.cs +++ b/src/Bicep.Core.IntegrationTests/PrettyPrint/PrettyPrinterV2Tests.cs @@ -16,7 +16,7 @@ public partial class PrettyPrinterV2Tests { public TestContext TestContext { get; set; } = null!; - [DataTestMethod] + [TestMethod] [DataRow(40)] [DataRow(80)] [TestCategory(BaselineHelper.BaselineTestCategory)] @@ -40,8 +40,8 @@ public void Print_VariousWidths_OptimizesLayoutAccordingly(int width) AssertConsistentOutput(output, options); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Print_DataSet_ProducesExpectedOutput(DataSet dataSet) { @@ -58,8 +58,8 @@ public void Print_DataSet_ProducesExpectedOutput(DataSet dataSet) AssertConsistentOutput(output, PrettyPrinterV2Options.Default); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Print_DataSet_ProducesConsistentNewlines(DataSet dataSet) { @@ -72,7 +72,7 @@ public void Print_DataSet_ProducesConsistentNewlines(DataSet dataSet) .HaveCount(1); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Print_ParamDataSet_ProducesExpectedOutput(BaselineData_Bicepparam baselineData) @@ -86,7 +86,7 @@ public void Print_ParamDataSet_ProducesExpectedOutput(BaselineData_Bicepparam ba AssertConsistentParamsOutput(output, PrettyPrinterV2Options.Default); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Print_ParamDataSet_ProducesConsistentNewlines(BaselineData_Bicepparam baselineData) diff --git a/src/Bicep.Core.IntegrationTests/RegistryTests.cs b/src/Bicep.Core.IntegrationTests/RegistryTests.cs index 96c973585e2..e9bef1c7f7b 100644 --- a/src/Bicep.Core.IntegrationTests/RegistryTests.cs +++ b/src/Bicep.Core.IntegrationTests/RegistryTests.cs @@ -199,8 +199,8 @@ public async Task ModuleRestoreContentionShouldProduceConsistentState() } } - [DataTestMethod] - [DynamicData(nameof(GetModuleInfoData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetModuleInfoData))] public async Task ModuleRestoreWithStuckFileLockShouldFailAfterTimeout(IEnumerable moduleInfos, int moduleCount, bool publishSource) { var dataSet = DataSets.Registry_LF; @@ -263,8 +263,8 @@ public async Task ModuleRestoreWithStuckFileLockShouldFailAfterTimeout(IEnumerab } } - [DataTestMethod] - [DynamicData(nameof(GetModuleInfoData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetModuleInfoData))] public async Task ForceModuleRestoreWithStuckFileLockShouldFailAfterTimeout(IEnumerable moduleInfos, int moduleCount, bool publishSource) { var dataSet = DataSets.Registry_LF; @@ -333,8 +333,8 @@ public async Task ForceModuleRestoreWithStuckFileLockShouldFailAfterTimeout(IEnu } - [DataTestMethod] - [DynamicData(nameof(GetModuleInfoData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetModuleInfoData))] public async Task ForceModuleRestoreShouldRestoreAllModules(IEnumerable moduleInfos, int moduleCount, bool publishSource) { var dataSet = DataSets.Registry_LF; diff --git a/src/Bicep.Core.IntegrationTests/ScenarioTests.cs b/src/Bicep.Core.IntegrationTests/ScenarioTests.cs index ce43b94c9bc..2089e8f891a 100644 --- a/src/Bicep.Core.IntegrationTests/ScenarioTests.cs +++ b/src/Bicep.Core.IntegrationTests/ScenarioTests.cs @@ -2781,7 +2781,7 @@ public void Test_Issue5371_positive_test_4() result.Template.Should().HaveValueAtPath("$.variables.myValue", 2147483647); } - [DataTestMethod] + [TestMethod] [DataRow("var myValue = -9223372036854775809")] [DataRow("var myValue = 9223372036854775808")] // https://github.com/Azure/bicep/issues/5371 @@ -3477,7 +3477,7 @@ public void Test_Issue_7241_1() /// /// https://github.com/Azure/bicep/issues/7241 /// - [DataTestMethod] + [TestMethod] [DataRow("copy")] [DataRow("COPY")] [DataRow("Copy")] diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/LoadFunctionsTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/LoadFunctionsTests.cs index edb0c174005..b0d2cbc8e88 100644 --- a/src/Bicep.Core.IntegrationTests/Scenarios/LoadFunctionsTests.cs +++ b/src/Bicep.Core.IntegrationTests/Scenarios/LoadFunctionsTests.cs @@ -39,7 +39,7 @@ public enum FunctionCase { loadTextContent, loadFileAsBase64, loadJsonContent, l _ => throw new NotSupportedException() }; - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent)] [DataRow(FunctionCase.loadFileAsBase64)] public void LoadFunction_inVariable(FunctionCase function) @@ -61,7 +61,7 @@ public void LoadFunction_inVariable(FunctionCase function) } } - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent)] [DataRow(FunctionCase.loadFileAsBase64)] public void LoadFunction_asPartOfObject_inVariables(FunctionCase function) @@ -86,7 +86,7 @@ public void LoadFunction_asPartOfObject_inVariables(FunctionCase function) } } - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent)] [DataRow(FunctionCase.loadFileAsBase64)] public void LoadFunction_InInterpolation_inVariable(FunctionCase function) @@ -123,7 +123,7 @@ private static CompilationHelper.CompilationResult CreateLoadTextContentTestComp return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); } - [DataTestMethod] + [TestMethod] [DataRow("utf-8")] [DataRow("utf-16BE")] [DataRow("utf-16")] @@ -142,7 +142,7 @@ public void LoadTextContent_AcceptsAvailableEncoding(string encoding) } } - [DataTestMethod] + [TestMethod] [DataRow("utf")] [DataRow("utf-32be")] [DataRow("utf-32le")] @@ -159,7 +159,7 @@ public void LoadTextContent_DisallowsUnknownEncoding(string encoding) diags.ExcludingLinterDiagnostics().Should().ContainSingleDiagnostic("BCP070", Diagnostics.DiagnosticLevel.Error, $"Argument of type \"'{encoding}'\" is not assignable to parameter of type \"{LanguageConstants.LoadTextContentEncodings}\"."); } - [DataTestMethod] + [TestMethod] [DataRow("utf")] [DataRow("iso-8859-2")] [DataRow("en-us")] @@ -173,7 +173,7 @@ public void LoadTextContent_DisallowsUnknownEncoding_passedFromVariable(string e diags.ExcludingLinterDiagnostics().Should().ContainSingleDiagnostic("BCP070", Diagnostics.DiagnosticLevel.Error, $"Argument of type \"'{encoding}'\" is not assignable to parameter of type \"{LanguageConstants.LoadTextContentEncodings}\"."); } - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent, "var fileName = 'message.txt'", "fileName", DisplayName = "loadTextContent: variable")] [DataRow(FunctionCase.loadFileAsBase64, "var fileName = 'message.txt'", "fileName", DisplayName = "loadFileAsBase64: variable")] [DataRow(FunctionCase.loadTextContent, @"var fileNames = [ @@ -219,7 +219,7 @@ public void LoadFunction_RequiresCompileTimeConstantArguments_Valid(FunctionCase } } - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent, "param fileName string = 'message.txt'", "fileName", DisplayName = "loadTextContent: parameter")] [DataRow(FunctionCase.loadFileAsBase64, "param fileName string = 'message.txt'", "fileName", DisplayName = "loadFileAsBase64: parameter")] [DataRow(FunctionCase.loadJsonContent, "param fileName string = 'message.txt'", "fileName", DisplayName = "loadJsonContent: parameter")] @@ -440,8 +440,8 @@ public static IEnumerable LoadFunction_InvalidPath_Data } } } - [DataTestMethod] - [DynamicData(nameof(LoadFunction_InvalidPath_Data), DynamicDataSourceType.Property)] + [TestMethod] + [DynamicData(nameof(LoadFunction_InvalidPath_Data))] public void LoadFunction_InvalidPath(FunctionCase function, string invalidPath) { var (template, diags, _) = CompilationHelper.Compile( @@ -455,7 +455,7 @@ public void LoadFunction_InvalidPath(FunctionCase function, string invalidPath) template!.Should().BeNull(); } - [DataTestMethod] + [TestMethod] [DataRow(FunctionCase.loadTextContent)] [DataRow(FunctionCase.loadFileAsBase64)] [DataRow(FunctionCase.loadJsonContent)] @@ -600,7 +600,7 @@ public void LoadJsonFunction() } } - [DataTestMethod] + [TestMethod] [DataRow("$")] [DataRow(".propObject")] [DataRow(".propArrayFloat[0]")] @@ -664,7 +664,7 @@ private static CompilationHelper.CompilationResult CreateLoadJsonContentTestComp return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); } - [DataTestMethod] + [TestMethod] [DataRow("utf-8")] [DataRow("utf-16BE")] [DataRow("utf-16")] @@ -686,7 +686,7 @@ public void LoadJsonContent_AcceptsAvailableEncoding(string encoding) } } - [DataTestMethod] + [TestMethod] [DataRow("utf")] [DataRow("utf-32be")] [DataRow("utf-32le")] @@ -944,7 +944,7 @@ public void LoadYamlFunction() } } - [DataTestMethod] + [TestMethod] [DataRow("$")] [DataRow(".propObject")] [DataRow(".propArrayFloat[0]")] @@ -1008,7 +1008,7 @@ private static CompilationHelper.CompilationResult CreateLoadYamlContentTestComp return CompilationHelper.Compile(new(), fileSet, fileSet.GetUri("main.bicep")); } - [DataTestMethod] + [TestMethod] [DataRow("utf-8")] [DataRow("utf-16BE")] [DataRow("utf-16")] @@ -1030,7 +1030,7 @@ public void LoadYamlContent_AcceptsAvailableEncoding(string encoding) } } - [DataTestMethod] + [TestMethod] [DataRow("utf")] [DataRow("utf-32be")] [DataRow("utf-32le")] @@ -1069,7 +1069,7 @@ public void LoadYamlContent_DisallowsUnknownEncoding(string encoding) // Users are likely to use "*" instead of "" as a wildcard so we test that "" and "*" behave similarly [DataRow(true)] [DataRow(false)] - [DataTestMethod] + [TestMethod] public void LoadDirectoryFileInfoFunction(bool withWildCard) { var (template, diags, _) = CompilationHelper.Compile( @@ -1100,7 +1100,7 @@ public void LoadDirectoryFileInfoFunction(bool withWildCard) [DataRow("ma*.bi*", "File.json")] [DataRow("*n.bi*", "File.json")] [DataRow("main?bicep", "File.json")] - [DataTestMethod] + [TestMethod] public void LoadDirectoryFileInfoWithPattern(string searchPattern, string fileToExclude) { var fullContent = TEST_FILES_ARM; @@ -1183,7 +1183,7 @@ public void LoadDirectoryFileInfo_returns_error_if_file_path_used_instead_of_dir [DataRow("/")] [DataRow("/helloWorld")] [DataRow("/path/to")] - [DataTestMethod] + [TestMethod] public void LoadDirectoryFileInfoErrorWhenRootedPath(string rootedPath) { var (template, diags, _) = CompilationHelper.Compile( @@ -1200,7 +1200,7 @@ public void LoadDirectoryFileInfoErrorWhenRootedPath(string rootedPath) [DataRow("C:/")] [DataRow("C:/helloworld")] [DataRow("C:/path/to")] - [DataTestMethod] + [TestMethod] public void LoadDirectoryFileInfoErrorWhenRootedPathWindows(string rootedPath) { var (template, diags, _) = CompilationHelper.Compile( @@ -1216,7 +1216,7 @@ public void LoadDirectoryFileInfoErrorWhenRootedPathWindows(string rootedPath) [DataRow(" ")] [DataRow(".")] - [DataTestMethod] + [TestMethod] public void LoadDirectoryFileInfoErrorWhenPathIsDotOrEmpty(string path) { var (template, diags, _) = CompilationHelper.Compile( diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/LocalJsonModuleTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/LocalJsonModuleTests.cs index de3d8322415..46d623c094a 100644 --- a/src/Bicep.Core.IntegrationTests/Scenarios/LocalJsonModuleTests.cs +++ b/src/Bicep.Core.IntegrationTests/Scenarios/LocalJsonModuleTests.cs @@ -16,7 +16,7 @@ namespace Bicep.Core.IntegrationTests.Scenarios [TestClass] public class LocalJsonModuleTests { - [DataTestMethod] + [TestMethod] [DataRow(@"{ }")] [DataRow(@"{ diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/NameofFunctionTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/NameofFunctionTests.cs index b64417afd26..a9dfa243ec1 100644 --- a/src/Bicep.Core.IntegrationTests/Scenarios/NameofFunctionTests.cs +++ b/src/Bicep.Core.IntegrationTests/Scenarios/NameofFunctionTests.cs @@ -15,7 +15,7 @@ public class NameofFunctionTests { [DataRow("prop", ".prop", "prop")] [DataRow("'complex-prop'", "['complex-prop']", "complex-prop")] - [DataTestMethod] + [TestMethod] public void NameofFunction_OnObjectProperty_ReturnsPropertyName(string propertyName, string propertyAccess, string expectedResult) { var result = CompilationHelper.Compile($$""" @@ -217,7 +217,7 @@ public void NameofFunction_OnLoopedResourceProperty_ReturnsResourcePropertyName( } } - [DataTestMethod] + [TestMethod] [DataRow("name", "name")] [DataRow("type", "type")] [DataRow("location", "location")] @@ -261,7 +261,7 @@ public void UsingNameofFunction_ShouldGenerateDependsOnEntries() } } - [DataTestMethod] + [TestMethod] [DataRow("'abc'")] [DataRow("123")] [DataRow("1+2-3")] diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/NullabilityTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/NullabilityTests.cs index c30cd53575c..8faf2d3e51d 100644 --- a/src/Bicep.Core.IntegrationTests/Scenarios/NullabilityTests.cs +++ b/src/Bicep.Core.IntegrationTests/Scenarios/NullabilityTests.cs @@ -16,8 +16,8 @@ namespace Bicep.Core.IntegrationTests.Scenarios; [TestClass] public class NullabilityTests { - [DataTestMethod] - [DynamicData(nameof(GetTemplatesWithSingleUnexpectedlyNullableValue), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTemplatesWithSingleUnexpectedlyNullableValue))] public void Unexpectedly_nullable_types_raise_fixable_warning(string templateWithNullablyTypedValue, string templateWithNonNullAssertion, TypeSymbol expectedType, TypeSymbol actualType) { var result = CompilationHelper.Compile(templateWithNullablyTypedValue); diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/TopLevelResourcePropertiesTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/TopLevelResourcePropertiesTests.cs index 5c025400202..47d40079f9e 100644 --- a/src/Bicep.Core.IntegrationTests/Scenarios/TopLevelResourcePropertiesTests.cs +++ b/src/Bicep.Core.IntegrationTests/Scenarios/TopLevelResourcePropertiesTests.cs @@ -58,7 +58,7 @@ public static IEnumerable ModuleFallbackProperties } [DynamicData(nameof(ResourceFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowWarningDiagnostics1_WhenNotDefinedInType(string property, string value) { @@ -78,7 +78,7 @@ public void FallbackProperty_ShouldShowWarningDiagnostics1_WhenNotDefinedInType( } [DynamicData(nameof(ResourceFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowWarningDiagnostics2_WhenNotDefinedInType(string property, string value) { @@ -98,7 +98,7 @@ public void FallbackProperty_ShouldShowWarningDiagnostics2_WhenNotDefinedInType( } [DynamicData(nameof(ResourceFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowWarningDiagnostics3_WhenNotDefinedInType(string property, string value) { @@ -120,7 +120,7 @@ public void FallbackProperty_ShouldShowWarningDiagnostics3_WhenNotDefinedInType( } [DynamicData(nameof(ResourceFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowWarning_WhenIsRead(string property, string value) { @@ -141,7 +141,7 @@ public void FallbackProperty_ShouldShowWarning_WhenIsRead(string property, strin } [DynamicData(nameof(ResourceFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldNotShowWarning_WhenDefinedInType(string property, string value) { @@ -159,7 +159,7 @@ public void FallbackProperty_ShouldNotShowWarning_WhenDefinedInType(string prope } [DynamicData(nameof(ModuleFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowError_WhenUsedOnModule(string property, string value) { var mainUri = new Uri("file:///main.bicep"); @@ -198,7 +198,7 @@ param inputb string } [DynamicData(nameof(ModuleFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowError_WhenUsedOnModuleParams(string property, string value) { @@ -239,7 +239,7 @@ param inputb string } [DynamicData(nameof(ModuleFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowError_WhenUsedOnModuleParams_ThroughVariable(string property, string value) { @@ -283,7 +283,7 @@ param inputb string } [DynamicData(nameof(ModuleFallbackProperties))] - [DataTestMethod] + [TestMethod] public void FallbackProperty_ShouldShowError_WhenReadOnModule(string property, string value) { var mainUri = new Uri("file:///main.bicep"); diff --git a/src/Bicep.Core.IntegrationTests/ScopeTests.cs b/src/Bicep.Core.IntegrationTests/ScopeTests.cs index d68672c812f..db8a50fcea6 100644 --- a/src/Bicep.Core.IntegrationTests/ScopeTests.cs +++ b/src/Bicep.Core.IntegrationTests/ScopeTests.cs @@ -42,7 +42,7 @@ public class ScopeTests [DataRow("resourceGroup", "resourceGroup('abc')", "resourceGroup", ExpectedRgSchema, "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'abc'), 'Microsoft.Resources/deployments', 'myMod'), '2025-04-01').outputs.hello.value]", "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'abc'), 'Microsoft.Resources/deployments', 'myMod')]")] [DataRow("resourceGroup", "resourceGroup('abc', 'def')", "resourceGroup", ExpectedRgSchema, "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', 'abc', 'def'), 'Microsoft.Resources/deployments', 'myMod'), '2025-04-01').outputs.hello.value]", "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', 'abc', 'def'), 'Microsoft.Resources/deployments', 'myMod')]")] [DataRow("resourceGroup", "tenant()", "tenant", ExpectedRgSchema, "[reference(tenantResourceId('Microsoft.Resources/deployments', 'myMod'), '2025-04-01').outputs.hello.value]", "[tenantResourceId('Microsoft.Resources/deployments', 'myMod')]")] - [DataTestMethod] + [TestMethod] public void Emitter_should_generate_correct_module_output_scope_strings(string targetScope, string moduleScope, string moduleTargetScope, string expectedSchema, string expectedOutput, string expectedResourceDependsOn) { var (template, diags, _) = CompilationHelper.Compile( @@ -81,7 +81,7 @@ public void Emitter_should_generate_correct_module_output_scope_strings(string t [DataRow("managementGroup", "[extensionResourceId(managementGroup().id, 'My.Rp/myResource', 'resourceA')]", "[extensionResourceId(managementGroup().id, 'Microsoft.Resources/deployments', 'myMod')]")] [DataRow("subscription", "[subscriptionResourceId('My.Rp/myResource', 'resourceA')]", "[subscriptionResourceId('Microsoft.Resources/deployments', 'myMod')]")] [DataRow("resourceGroup", "[resourceId('My.Rp/myResource', 'resourceA')]", "[resourceId('Microsoft.Resources/deployments', 'myMod')]")] - [DataTestMethod] + [TestMethod] public void Emitter_should_generate_correct_dependsOn_resourceIds(string targetScope, string expectedModuleDependsOn, string expectedResourceDependsOn) { var (template, diags, _) = CompilationHelper.Compile( @@ -195,7 +195,7 @@ public void Emitter_should_generate_fullyQualifiedResourceId_in_extension_scope_ [DataRow("managementGroup", "[extensionResourceId(managementGroup().id, 'My.Rp/myResource', 'resourceA')]", "[reference(extensionResourceId(managementGroup().id, 'My.Rp/myResource', 'resourceA'), '2020-01-01').myProp]")] [DataRow("subscription", "[subscriptionResourceId('My.Rp/myResource', 'resourceA')]", "[reference(subscriptionResourceId('My.Rp/myResource', 'resourceA'), '2020-01-01').myProp]")] [DataRow("resourceGroup", "[resourceId('My.Rp/myResource', 'resourceA')]", "[reference(resourceId('My.Rp/myResource', 'resourceA'), '2020-01-01').myProp]")] - [DataTestMethod] + [TestMethod] public void Emitter_should_generate_correct_references_for_existing_resources(string targetScope, string expectedScopeExpression, string expectedReferenceExpression) { var (template, diags, _) = CompilationHelper.Compile(@" @@ -365,7 +365,7 @@ public void Extensions_of_existing_resources_are_permitted() [DataRow("subscription", true)] [DataRow("managementGroup", true)] [DataRow("tenant", false)] - [DataTestMethod] + [TestMethod] public void Tenant_scope_resources_can_be_deployed_from_anywhere(string targetScope, bool tenantScopeExpected) { var typeReference = ResourceTypeReference.Parse("My.Rp/myResource@2020-01-01"); diff --git a/src/Bicep.Core.IntegrationTests/Semantics/NamespaceTests.cs b/src/Bicep.Core.IntegrationTests/Semantics/NamespaceTests.cs index 2010a7bf570..a3ede70ec5d 100644 --- a/src/Bicep.Core.IntegrationTests/Semantics/NamespaceTests.cs +++ b/src/Bicep.Core.IntegrationTests/Semantics/NamespaceTests.cs @@ -23,8 +23,8 @@ public class NamespaceTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] - [DynamicData(nameof(GetNamespaces), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetNamespaces), DynamicDataDisplayName = nameof(GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void FunctionsShouldHaveExpectedSignatures(INamespaceSymbol @namespace) { diff --git a/src/Bicep.Core.IntegrationTests/Semantics/ParamsSemanticModelTests.cs b/src/Bicep.Core.IntegrationTests/Semantics/ParamsSemanticModelTests.cs index 0fc6766ac44..cd57e1656f0 100644 --- a/src/Bicep.Core.IntegrationTests/Semantics/ParamsSemanticModelTests.cs +++ b/src/Bicep.Core.IntegrationTests/Semantics/ParamsSemanticModelTests.cs @@ -28,7 +28,7 @@ private async Task CreateSemanticModel(ServiceBuilder services, s return compilation.GetEntrypointSemanticModel(); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ProgramsShouldProduceExpectedDiagnostic(BaselineData_Bicepparam baselineData) @@ -51,7 +51,7 @@ public async Task ProgramsShouldProduceExpectedDiagnostic(BaselineData_Biceppara data.Diagnostics.ShouldHaveExpectedValue(); } - [DataTestMethod] + [TestMethod] [BaselineData_Bicepparam.TestData()] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ProgramsShouldProduceExpectedUserDeclaredSymbols(BaselineData_Bicepparam baselineData) diff --git a/src/Bicep.Core.IntegrationTests/Semantics/SemanticModelTests.cs b/src/Bicep.Core.IntegrationTests/Semantics/SemanticModelTests.cs index cf60e160376..78afa67b333 100644 --- a/src/Bicep.Core.IntegrationTests/Semantics/SemanticModelTests.cs +++ b/src/Bicep.Core.IntegrationTests/Semantics/SemanticModelTests.cs @@ -34,8 +34,8 @@ public class SemanticModelTests // NOTE: Uses the linter analyzers specified in BicepTestConstants.BuiltInConfigurationWithProblematicAnalyzersDisabled // Problematic ones that should be disabled in this and most other tests by default can be added to BicepTestConstants.AnalyzerRulesToDisableInTests - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ProgramsShouldProduceExpectedDiagnostics(DataSet dataSet) { @@ -67,8 +67,8 @@ public void EndOfFileFollowingSpaceAfterParameterKeyWordShouldNotThrow() FluentActions.Invoking(() => compilation.GetEntrypointSemanticModel().GetAllDiagnostics()).Should().NotThrow(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ProgramsShouldProduceExpectedUserDeclaredSymbols(DataSet dataSet) { @@ -98,8 +98,8 @@ string getLoggingString(DeclaredSymbol symbol) actualPath: resultsFile); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task NameBindingsShouldBeConsistent(DataSet dataSet) { var (compilation, _, _) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -177,8 +177,8 @@ s is ErroredImportSymbol || } } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task FindReferencesResultsShouldIncludeAllSymbolReferenceSyntaxNodes(DataSet dataSet) { var (compilation, _, _) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -297,8 +297,8 @@ public void GetAllDiagnostics_WithNoDisableNextLineDiagnosticsDirectiveInPreviou compilation.GetEntrypointSemanticModel().GetAllDiagnostics().Count().Should().Be(1); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task All_nodes_should_be_parented(DataSet dataSet) { var (compilation, outputDirectory, _) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -318,8 +318,8 @@ public async Task All_nodes_should_be_parented(DataSet dataSet) } } - [DataTestMethod] - [DynamicData(nameof(GetValidDataSets), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetValidDataSets), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ProgramsShouldProduceExpectedIrTree(DataSet dataSet) { diff --git a/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs b/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs index a3ffc0f8131..d2bbd5eddb1 100644 --- a/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs +++ b/src/Bicep.Core.IntegrationTests/SourceArchiveTests.cs @@ -431,7 +431,7 @@ public async Task CreateFrom_WithNotResolvedModules_IgnoresThoseModules() ("files/_cache_/br/mockregistry.io/test$module1/v1$/main.json", moduleTemplateText)); } - [DataTestMethod] + [TestMethod] [DataRow("main.bicep", "files/main.bicep", ArchivedSourceFileKind.Bicep, null)] [DataRow("local1.bicep", "files/local1.bicep", ArchivedSourceFileKind.Bicep, null)] [DataRow("modules/local2.bicep", "files/modules/local2.bicep", ArchivedSourceFileKind.Bicep, null)] @@ -451,7 +451,7 @@ public async Task FindSourceFile_ExistingPath_ReturnsExpectedFile(string path, s file.Metadata.SourceArtifactId.Should().Be(expectedSourceArtifactId); } - [DataTestMethod] + [TestMethod] [DataRow("foo.bicep")] [DataRow("bar.bicep")] public async Task FindSourceFile_NonexistentPath_Throws(string path) diff --git a/src/Bicep.Core.IntegrationTests/TypeSystem/TypeValidationTests.cs b/src/Bicep.Core.IntegrationTests/TypeSystem/TypeValidationTests.cs index e92ca9980f8..6d4f9dcf399 100644 --- a/src/Bicep.Core.IntegrationTests/TypeSystem/TypeValidationTests.cs +++ b/src/Bicep.Core.IntegrationTests/TypeSystem/TypeValidationTests.cs @@ -29,7 +29,7 @@ private static CompilationHelper.CompilationResult Compile(string programText, I private static SemanticModel GetSemanticModelForTest(string programText, IEnumerable definedTypes) => Compile(programText, definedTypes).Compilation.GetEntrypointSemanticModel(); - [DataTestMethod] + [TestMethod] [DataRow(TypeSymbolValidationFlags.Default, DiagnosticLevel.Error)] [DataRow(TypeSymbolValidationFlags.WarnOnTypeMismatch, DiagnosticLevel.Warning)] public void Type_validation_runs_on_compilation_successfully(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) @@ -48,7 +48,7 @@ public void Type_validation_runs_on_compilation_successfully(TypeSymbolValidatio model.GetAllDiagnostics().Should().BeEmpty(); } - [DataTestMethod] + [TestMethod] [DataRow(TypeSymbolValidationFlags.Default, DiagnosticLevel.Error)] [DataRow(TypeSymbolValidationFlags.WarnOnTypeMismatch | TypeSymbolValidationFlags.WarnOnPropertyTypeMismatch, DiagnosticLevel.Warning)] public void Type_validation_runs_on_compilation_common_failures(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) @@ -130,7 +130,7 @@ public void Type_validation_runs_on_compilation_common_failures(TypeSymbolValida ); } - [DataTestMethod] + [TestMethod] [DataRow(TypeSymbolValidationFlags.Default, DiagnosticLevel.Error)] [DataRow(TypeSymbolValidationFlags.WarnOnTypeMismatch, DiagnosticLevel.Warning)] public void Type_validation_narrowing_on_union_types(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) @@ -175,7 +175,7 @@ public void Type_validation_narrowing_on_union_types(TypeSymbolValidationFlags v ); } - [DataTestMethod] + [TestMethod] [DataRow(TypeSymbolValidationFlags.Default, DiagnosticLevel.Error)] [DataRow(TypeSymbolValidationFlags.WarnOnTypeMismatch | TypeSymbolValidationFlags.WarnOnPropertyTypeMismatch, DiagnosticLevel.Warning)] public void Type_validation_narrowing_on_discriminated_object_types(TypeSymbolValidationFlags validationFlags, DiagnosticLevel expectedDiagnosticLevel) diff --git a/src/Bicep.Core.IntegrationTests/UserDefinedDiscriminatedObjectUnionTests.cs b/src/Bicep.Core.IntegrationTests/UserDefinedDiscriminatedObjectUnionTests.cs index a538e677410..c8d40c13e09 100644 --- a/src/Bicep.Core.IntegrationTests/UserDefinedDiscriminatedObjectUnionTests.cs +++ b/src/Bicep.Core.IntegrationTests/UserDefinedDiscriminatedObjectUnionTests.cs @@ -60,7 +60,7 @@ public void DiscriminatedObjectUnions_Basic() """)); } - [DataTestMethod] + [TestMethod] [DataRow("typeA | typeB | typeC | typeD")] [DataRow("(typeA | typeB | typeC | typeD)")] [DataRow("(typeA) | typeB | typeC | typeD")] @@ -402,7 +402,7 @@ public void DiscriminatedObjectUnions_Error_Discriminator_MissingOnMember() result.Should().OnlyContainDiagnostic("BCP364", DiagnosticLevel.Error, "The property \"type\" must be a required string literal on all union member types."); } - [DataTestMethod] + [TestMethod] [DataRow("0")] [DataRow("true")] [DataRow("'a'?")] @@ -447,7 +447,7 @@ public void DiscriminatedObjectUnions_Error_Discriminator_DuplicatedAcrossMember result.Should().OnlyContainDiagnostic("BCP365", DiagnosticLevel.Error, "The value \"'a'\" for discriminator property \"type\" is duplicated across multiple union member types. The value must be unique across all union member types."); } - [DataTestMethod] + [TestMethod] [DataRow("string")] [DataRow("object")] [DataRow("typeA")] @@ -472,7 +472,7 @@ public void DiscriminatedObjectUnions_Error_DiscriminatorAppliedToNonObjectOnlyU result.Should().OnlyContainDiagnostic("BCP363", DiagnosticLevel.Error, "The \"discriminator\" decorator can only be applied to object-only union types with unique member types."); } - [DataTestMethod] + [TestMethod] [DataRow("", "BCP071")] [DataRow("0", "BCP070")] public void DiscriminatedObjectUnions_Error_Discriminator_InvalidArgument(string decoratorArgument, string expectedDiagnosticCode) diff --git a/src/Bicep.Core.IntegrationTests/UserDefinedTypeTests.cs b/src/Bicep.Core.IntegrationTests/UserDefinedTypeTests.cs index eeacb524381..d3ce5ba8ef3 100644 --- a/src/Bicep.Core.IntegrationTests/UserDefinedTypeTests.cs +++ b/src/Bicep.Core.IntegrationTests/UserDefinedTypeTests.cs @@ -1189,7 +1189,7 @@ public void Type_property_access_is_escaped_correctly() } // https://github.com/azure/bicep/issues/12920 - [DataTestMethod] + [TestMethod] [DataRow("test.bar", "BCP053", """The type "{ foo: { bar: string } }" does not contain property "bar". Available properties include "foo".""")] [DataRow("{ foo: string }.foo", "BCP391", "Type member access is only supported on a reference to a named type.")] public void Invalid_type_property_access_raises_diagnostic(string accessExpression, string expectedErrorCode, string expectedErrorMessage) @@ -1297,7 +1297,7 @@ public void Type_index_access_is_valid_type() """)); } - [DataTestMethod] + [TestMethod] [DataRow("test[1]", "BCP311", """The provided index value of "1" is not valid for type "[{ bar: string }]". Indexes for this type must be between 0 and 0.""")] [DataRow("test[-1]", "BCP387", "Indexing into a type requires an integer greater than or equal to 0.")] [DataRow("[string][0]", "BCP391", "Type member access is only supported on a reference to a named type.")] @@ -1366,7 +1366,7 @@ public void Type_additional_properties_access_is_valid_type() """)); } - [DataTestMethod] + [TestMethod] [DataRow("test.*", "BCP389", """The type "{ foo: string }" does not declare an additional properties type.""")] [DataRow("object.*", "BCP389", """The type "object" does not declare an additional properties type.""")] [DataRow("{ *: string }.*", "BCP391", "Type member access is only supported on a reference to a named type.")] @@ -1475,7 +1475,7 @@ public void Type_element_access_is_valid_type() """)); } - [DataTestMethod] + [TestMethod] [DataRow("test[*]", "BCP390", "The array item type access operator ('[*]') can only be used with typed arrays.")] [DataRow("array[*]", "BCP390", "The array item type access operator ('[*]') can only be used with typed arrays.")] [DataRow("test[0][*]", "BCP390", "The array item type access operator ('[*]') can only be used with typed arrays.")] @@ -1766,7 +1766,7 @@ param siteProperties resourceInput<'Microsoft.Web/sites@2022-09-01'>.properties ); } - [DataTestMethod] + [TestMethod] [DataRow("type resourceInput = resourceInput<'Microsoft.Compute/virtualMachines'>")] // should be caught at syntax level [DataRow("type resourceInput = resourceInput<'Microsoft.Compute/virtualMachines'>.properties")] // should be caught by type manager public void Parameterized_type_recursion_raises_diagnostic(string template) @@ -1782,7 +1782,7 @@ public void Parameterized_type_recursion_raises_diagnostic(string template) } // https://www.github.com/Azure/bicep/issues/15277 - [DataTestMethod] + [TestMethod] [DataRow("type resourceDerived = resourceInput<'Microsoft.Compute/virtualMachines/extensions@2019-12-01'>.properties.settings", "$.definitions.resourceDerived")] [DataRow("param resourceDerived resourceInput<'Microsoft.Compute/virtualMachines/extensions@2019-12-01'>.properties.settings", "$.parameters.resourceDerived")] [DataRow("output resourceDerived resourceInput<'Microsoft.Compute/virtualMachines/extensions@2019-12-01'>.properties.settings = 'foo'", "$.outputs.resourceDerived")] diff --git a/src/Bicep.Core.Samples/DataSetsTests.cs b/src/Bicep.Core.Samples/DataSetsTests.cs index 18c0cfba8ba..9a3dbfa0af6 100644 --- a/src/Bicep.Core.Samples/DataSetsTests.cs +++ b/src/Bicep.Core.Samples/DataSetsTests.cs @@ -15,8 +15,8 @@ public class DataSetsTests private static readonly Regex Pattern_LF = new(@"^(\n)+$", RegexOptions.Compiled | RegexOptions.CultureInvariant); - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void DataSetShouldBeValid(DataSet dataSet) { dataSet.Name.Should().NotBeNullOrWhiteSpace(); @@ -29,8 +29,8 @@ public void DataSetShouldBeValid(DataSet dataSet) dataSet.Symbols.Should().NotBeNull(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public void DataSetBicepLineEndingsShouldMatchDataSetNameSuffix(DataSet dataSet) { var lineEndingTokens = GetLineEndingTokens(dataSet.Bicep); diff --git a/src/Bicep.Core.UnitTests/Analyzers/Linter/ApiVersions/AzureResourceApiVersionTests.cs b/src/Bicep.Core.UnitTests/Analyzers/Linter/ApiVersions/AzureResourceApiVersionTests.cs index aa24d52b0e9..331640fffde 100644 --- a/src/Bicep.Core.UnitTests/Analyzers/Linter/ApiVersions/AzureResourceApiVersionTests.cs +++ b/src/Bicep.Core.UnitTests/Analyzers/Linter/ApiVersions/AzureResourceApiVersionTests.cs @@ -11,7 +11,7 @@ namespace Bicep.Core.UnitTests.Analyzers.Linter.ApiVersions [TestClass] public class AzureResourceApiVersionTests { - [DataTestMethod] + [TestMethod] [DataRow("2001-01-01", "2001-01-01", "")] [DataRow("9999-12-31", "9999-12-31", "")] [DataRow("9999-12-31-alpha", "9999-12-31", "-alpha")] @@ -28,7 +28,7 @@ public void TryParse_ValidApiVersion_ReturnsTrueAndParsedApiVersion(string value apiVersion.Suffix.Should().Be(suffix); } - [DataTestMethod] + [TestMethod] [DataRow("2001-01-011")] [DataRow("whatever")] [DataRow("9999-12-31-")] diff --git a/src/Bicep.Core.UnitTests/ApiVersion/ApiVersionProviderTests.cs b/src/Bicep.Core.UnitTests/ApiVersion/ApiVersionProviderTests.cs index c5c68f95b3f..f02fda747c7 100644 --- a/src/Bicep.Core.UnitTests/ApiVersion/ApiVersionProviderTests.cs +++ b/src/Bicep.Core.UnitTests/ApiVersion/ApiVersionProviderTests.cs @@ -17,7 +17,7 @@ public class ApiVersionProviderTests [DataRow("invalid-text")] [DataRow("fake.Network/dnszones", "2415-05-04-preview", "2416-04-01", "2417-09-01", "2417-10-01", "2418-03-01-preview", "2418-05-01")] [DataRow("fAKE.NETWORK/DNSZONES", "2415-05-04-preview", "2416-04-01", "2417-09-01", "2417-10-01", "2418-03-01-preview", "2418-05-01")] - [DataTestMethod] + [TestMethod] public void GetApiVersions(string fullyQualifiedName, params string[] expected) { var apiVersionProvider = FakeResourceTypes.GetFakeApiVersionProvider(FakeResourceTypes.ResourceScopeTypes); diff --git a/src/Bicep.Core.UnitTests/Assertions/BaselineHelper.cs b/src/Bicep.Core.UnitTests/Assertions/BaselineHelper.cs index e94a4272375..7a18d2e2791 100644 --- a/src/Bicep.Core.UnitTests/Assertions/BaselineHelper.cs +++ b/src/Bicep.Core.UnitTests/Assertions/BaselineHelper.cs @@ -16,7 +16,7 @@ public static class BaselineHelper public const string BaselineTestCategory = "Baseline"; public static bool ShouldSetBaseline(TestContext testContext) => - testContext.Properties.Contains(SetBaseLineSettingName) && string.Equals(testContext.Properties[SetBaseLineSettingName] as string, bool.TrueString, StringComparison.OrdinalIgnoreCase); + testContext.Properties.ContainsKey(SetBaseLineSettingName) && string.Equals(testContext.Properties[SetBaseLineSettingName] as string, bool.TrueString, StringComparison.OrdinalIgnoreCase); public static void SetBaseline(string actualPath, string expectedPath) { diff --git a/src/Bicep.Core.UnitTests/AssertionsTests/ResultAssertionsExtensionsTests.cs b/src/Bicep.Core.UnitTests/AssertionsTests/ResultAssertionsExtensionsTests.cs index c6f6effafae..6e7f8f2d1e9 100644 --- a/src/Bicep.Core.UnitTests/AssertionsTests/ResultAssertionsExtensionsTests.cs +++ b/src/Bicep.Core.UnitTests/AssertionsTests/ResultAssertionsExtensionsTests.cs @@ -4,6 +4,7 @@ using Bicep.Core.UnitTests.Assertions; using Bicep.Core.Utils; using FluentAssertions; +using FluentAssertions.Execution; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Bicep.Core.UnitTests.AssertionsTests; @@ -30,7 +31,7 @@ public void ShouldBeFailure_ButIsSuccess() { var result = new Result("my success"); var func = () => result.Should().BeFailure("Simon didn't say"); - func.Should().Throw().WithMessage("Expected result to be a failure because Simon didn't say, but it was a success with value \"my success\""); + func.Should().Throw().WithMessage("Expected result to be a failure because Simon didn't say, but it was a success with value \"my success\""); } [TestMethod] @@ -38,7 +39,7 @@ public void ShouldBeFailureWithValue_ButIsSuccess() { var result = new Result("my success"); var func = () => result.Should().BeFailureWithValue(501, "Simon didn't say"); - func.Should().Throw().WithMessage("Expected result to be a failure with value 501 because Simon didn't say, but it was a success with value \"my success\""); + func.Should().Throw().WithMessage("Expected result to be a failure with value 501 because Simon didn't say, but it was a success with value \"my success\""); } [TestMethod] @@ -46,7 +47,7 @@ public void ShouldBeFailureWithValue_WithWrongValue() { var result = new Result(404); var func = () => result.Should().BeFailureWithValue(501, "Simon didn't say"); - func.Should().Throw().WithMessage("Expected result to be a failure with value 501 because Simon didn't say, but the failure had value 404"); + func.Should().Throw().WithMessage("Expected result to be a failure with value 501 because Simon didn't say, but the failure had value 404"); } [TestMethod] @@ -68,7 +69,7 @@ public void ShouldBeSuccess_ButIsFailure() { var result = new Result(404); var func = () => result.Should().BeSuccess("Simon said"); - func.Should().Throw().WithMessage("Expected result to be a success because Simon said, but it was a failure with value 404"); + func.Should().Throw().WithMessage("Expected result to be a success because Simon said, but it was a failure with value 404"); } [TestMethod] @@ -76,7 +77,7 @@ public void ShouldBeSuccessWithValue_ButIsFailure() { var result = new Result(404); var func = () => result.Should().BeSuccessWithValue("my success", "Simon said"); - func.Should().Throw().WithMessage("Expected result to be a success with value \"my success\" because Simon said, but it was a failure with value 404"); + func.Should().Throw().WithMessage("Expected result to be a success with value \"my success\" because Simon said, but it was a failure with value 404"); } [TestMethod] @@ -84,6 +85,6 @@ public void ShouldBeSuccessWithValue_WithWrongValue() { var result = new Result("your success"); var func = () => result.Should().BeSuccessWithValue("my success", "Red Rover should come over"); - func.Should().Throw().WithMessage("Expected result to be a success with value \"my success\" because Red Rover should come over, but the actual value was \"your success\""); + func.Should().Throw().WithMessage("Expected result to be a success with value \"my success\" because Red Rover should come over, but the actual value was \"your success\""); } } diff --git a/src/Bicep.Core.UnitTests/AssertionsTests/StringAssertionsExtensionsTests.cs b/src/Bicep.Core.UnitTests/AssertionsTests/StringAssertionsExtensionsTests.cs index b91294a5238..44d9521be56 100644 --- a/src/Bicep.Core.UnitTests/AssertionsTests/StringAssertionsExtensionsTests.cs +++ b/src/Bicep.Core.UnitTests/AssertionsTests/StringAssertionsExtensionsTests.cs @@ -20,7 +20,7 @@ public class StringAssertionsExtensionsTests new[] { "Hello", "Dolly" }, StringComparison.InvariantCultureIgnoreCase, "Did not expect string \"hello there\" to contain any of the strings: {\"Hello\"} because I said so.")] - [DataTestMethod] + [TestMethod] public void NotContainAny_WithStringComparison(string text, IEnumerable values, StringComparison stringComparison, string? expectedFailureMessage) { string? actualMessage; diff --git a/src/Bicep.Core.UnitTests/Collections/Trees/IntervalTreeNodeTests.cs b/src/Bicep.Core.UnitTests/Collections/Trees/IntervalTreeNodeTests.cs index 65793ebda0a..8166e1c3aee 100644 --- a/src/Bicep.Core.UnitTests/Collections/Trees/IntervalTreeNodeTests.cs +++ b/src/Bicep.Core.UnitTests/Collections/Trees/IntervalTreeNodeTests.cs @@ -11,7 +11,7 @@ namespace Bicep.Core.UnitTests.Collections.Trees [TestClass] public class IntervalTreeNodeTests { - [DataTestMethod] + [TestMethod] [DataRow(0, -1)] [DataRow(100, 20)] [DataRow(10, 0)] @@ -23,7 +23,7 @@ public void IntervalTree_EndSmallerThanStart_Throws(int start, int end) .WithMessage($"The argument {nameof(end)} ({end}) cannot be smaller than the argument {nameof(start)} ({start})."); } - [DataTestMethod] + [TestMethod] [DataRow(0, 0)] [DataRow(100, 200)] [DataRow(20, 21)] diff --git a/src/Bicep.Core.UnitTests/Configuration/BicepConfigurationTests.cs b/src/Bicep.Core.UnitTests/Configuration/BicepConfigurationTests.cs index d7c11467a46..7b14f3eb4e7 100644 --- a/src/Bicep.Core.UnitTests/Configuration/BicepConfigurationTests.cs +++ b/src/Bicep.Core.UnitTests/Configuration/BicepConfigurationTests.cs @@ -64,7 +64,7 @@ public void Bind_and_serialize_preserve_documentation_configuration() "\"owner\": \"Platform\""); } - [DataTestMethod] + [TestMethod] [DataRow("""{ "output": null }""", "output, template, and examples")] [DataRow("""{ "template": null }""", "output, template, and examples")] [DataRow("""{ "examples": null }""", "output, template, and examples")] @@ -108,8 +108,8 @@ public void Documentation_configuration_normalizes_omitted_nested_collections() configuration.Data.Examples.Reassignments.Single().From.Exclude.Should().BeEmpty(); } - [DataTestMethod] - [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTestData))] public void RootConfiguration_LeadingTildeInCacheRootDirectory_ExpandPath(string cacheRootDirectory, string expectedExpandedDirectory) { var configuration = BicepTestConstants.BuiltInConfiguration.With(cacheRootDirectory: cacheRootDirectory); diff --git a/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs b/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs index 52f6319a556..32e830e6290 100644 --- a/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs +++ b/src/Bicep.Core.UnitTests/Configuration/ConfigurationManagerTests.cs @@ -610,7 +610,7 @@ public void GetConfiguration_IOExceptionWhenDiscoveringConfiguration_ReturnsDefa configuration.ToUtf8Json().Should().Be(BicepConfiguration.BuiltIn.ToUtf8Json()); } - [DataTestMethod] + [TestMethod] [DataRow(""" { "cloud": { @@ -744,7 +744,7 @@ public void GetConfiguration_InvalidUserAssignedIdentityOptions_PropagatesConfig diagnostics[0].Message.Should().Be($"Failed to parse the contents of the Bicep configuration file \"{fileSet.GetUri("bicepconfig.json")}\": {expectedExceptionMessage}"); } - [DataTestMethod] + [TestMethod] [DataRow("repo")] [DataRow("re%20po")] public void GetConfiguration_ValidCustomConfiguration_OverridesBuiltInConfiguration(string root) diff --git a/src/Bicep.Core.UnitTests/Configuration/ImplicitExtensionsTests.cs b/src/Bicep.Core.UnitTests/Configuration/ImplicitExtensionsTests.cs index 402eafb4273..15752be6462 100644 --- a/src/Bicep.Core.UnitTests/Configuration/ImplicitExtensionsTests.cs +++ b/src/Bicep.Core.UnitTests/Configuration/ImplicitExtensionsTests.cs @@ -10,7 +10,7 @@ namespace Bicep.Core.UnitTests.Configuration [TestClass] public class ImplicitExtensionsTests { - [DataTestMethod] + [TestMethod] [DataRow(new string[] { "extension1", "extension2" }, 2)] [DataRow(new string[] { "extension1" }, 1)] [DataRow(new string[] { }, 0)] diff --git a/src/Bicep.Core.UnitTests/Diagnostics/ErrorBuilderTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/ErrorBuilderTests.cs index cb95f671a03..c725a2912bf 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/ErrorBuilderTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/ErrorBuilderTests.cs @@ -338,7 +338,7 @@ private static void ExpectDiagnosticWithFixedText(string text, string expectedTe name: }" )] - [DataTestMethod] + [TestMethod] public void MissingTypePropertiesHasFix(string text, string expectedFix) { ExpectDiagnosticWithFixedText(text, expectedFix); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/Linter/Common/FindPossibleSecretsVisitorTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/Linter/Common/FindPossibleSecretsVisitorTests.cs index 1badd39d955..00696e65e3d 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/Linter/Common/FindPossibleSecretsVisitorTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/Linter/Common/FindPossibleSecretsVisitorTests.cs @@ -157,7 +157,7 @@ param storageName string ", "function 'listAnything'" )] - [DataTestMethod] + [TestMethod] public void Test(string text, params string[] expectedMessages) { CompileAndTest(text, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterAnalyzerTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterAnalyzerTests.cs index 02a9fb04a6a..21bc1dc12e4 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterAnalyzerTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterAnalyzerTests.cs @@ -45,7 +45,7 @@ public void HasBuiltInRules() } // No need to add new rules here, just checking a few known ones - [DataTestMethod] + [TestMethod] [DataRow(AdminUsernameShouldNotBeLiteralRule.Code)] [DataRow(ExplicitValuesForLocationParamsRule.Code)] [DataRow(NoHardcodedEnvironmentUrlsRule.Code)] @@ -98,14 +98,14 @@ public void MostRulesEnabledByDefault() numberEnabled.Should().BeGreaterThan(ruleSet.Length / 2, "most rules should probably be enabled by default"); } - [DataTestMethod] + [TestMethod] [TestData] public void AllRulesHaveDescription(IBicepAnalyzerRule rule) { rule.Description.Length.Should().BeGreaterThan(0); } - [DataTestMethod()] + [TestMethod] [TestData] public void RulesShouldNotSpecifyOverriddenDiagnosticLevel_UnlessDifferingFromCategoryDefault(IBicepAnalyzerRule rule) { diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/AdminUsernameShouldNotBeLiteralRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/AdminUsernameShouldNotBeLiteralRuleTests.cs index d6f71f0a829..355e78f1ce1 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/AdminUsernameShouldNotBeLiteralRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/AdminUsernameShouldNotBeLiteralRuleTests.cs @@ -25,7 +25,7 @@ private void CompileAndTest(string text, int expectedErrorCount, Options? option } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesStringLiteral_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -42,7 +42,7 @@ public void If_UsesStringLiteral_ShouldFail(int diagnosticCount, string text) } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesStringLiteral_And_AdminUserNameMismatchesCase_ShouldStillFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -61,7 +61,7 @@ public void If_UsesStringLiteral_And_AdminUserNameMismatchesCase_ShouldStillFail } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesStringLiteral_AndInsideChildResource_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -91,7 +91,7 @@ public void If_UsesStringLiteral_AndInsideChildResource_ShouldFail(int diagnosti } } ")] - [DataTestMethod] + [TestMethod] public void If_MultipleResources_FindsAllErrors(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -113,7 +113,7 @@ public void If_MultipleResources_FindsAllErrors(int diagnosticCount, string text } } ")] - [DataTestMethod] + [TestMethod] public void If_MultiplePropertiesLevels_FindsAllErrors(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -132,7 +132,7 @@ param p1 string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesParameter_ShouldPass(string text) { CompileAndTest(text, 0); @@ -153,7 +153,7 @@ public void If_UsesParameter_ShouldPass(string text) } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectParameterPropertyRef_ShouldPass(string text) { CompileAndTest(text, 0); @@ -173,7 +173,7 @@ public void If_UsesObjectParameterPropertyRef_ShouldPass(string text) } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesStringVariable_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -191,7 +191,7 @@ param idx int } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesStringInterpolation_ShouldPass(string text) { CompileAndTest(text, 0); @@ -208,7 +208,7 @@ public void If_UsesStringInterpolation_ShouldPass(string text) } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesExpression_ShouldPass(string text) { CompileAndTest(text, 0); @@ -233,7 +233,7 @@ param username string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariable_ThatResolvesToParameter_ShouldPass(string text) { CompileAndTest(text, 0); @@ -258,7 +258,7 @@ param username string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariable_ThatResolvesToStringExpression_ShouldPass(string text) { CompileAndTest(text, 0); @@ -283,7 +283,7 @@ param username string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariable_ThatResolvesToUndefined_ShouldPass(string text) { CompileAndTest(text, 0, new Options(OnCompileErrors.Ignore)); @@ -308,7 +308,7 @@ param username string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariables_ThatContainsSyntaxError_ShouldPass(string text) { CompileAndTest(text, 0, new Options(OnCompileErrors.Ignore)); @@ -333,7 +333,7 @@ param username string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariables_AndReferencesInvalidProperty_ShouldPass(string text) { CompileAndTest(text, 0, new Options(OnCompileErrors.Ignore)); @@ -356,7 +356,7 @@ param location string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariable_ThatResolvesToStringLiteral_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -381,7 +381,7 @@ param location string } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesNestedObjectVariable_ThatResolvesToStringLiteral_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -406,7 +406,7 @@ public void If_UsesNestedObjectVariable_ThatResolvesToStringLiteral_ShouldFail(i } } ")] - [DataTestMethod] + [TestMethod] public void If_UsesObjectVariable_ThatResolvesDeeplyToStringLiteral_ShouldFail(int diagnosticCount, string text) { CompileAndTest(text, diagnosticCount); @@ -431,7 +431,7 @@ param adminUsername string adminUsername: 'hello' } ")] - [DataTestMethod] + [TestMethod] public void If_NotInsideResource_ShouldPass(string text) { CompileAndTest(text, 0); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/DecompilerCleanupRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/DecompilerCleanupRuleTests.cs index 7030595662a..5644b59de70 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/DecompilerCleanupRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/DecompilerCleanupRuleTests.cs @@ -9,7 +9,7 @@ namespace Bicep.Core.UnitTests.Diagnostics.LinterRuleTests [TestClass] public class DecompilerCleanupRuleTests : LinterRuleTestsBase { - [DataTestMethod] + [TestMethod] [DataRow( @" ", @@ -148,7 +148,7 @@ public void ResourceNameFluff(string bicep, string[] expectedFailingResourceName new() { IncludePosition = IncludePosition.None }); } - [DataTestMethod] + [TestMethod] [DataRow( @" ", @@ -229,7 +229,7 @@ public void VariableNameFluff(string bicep, string[] expectedFailingResourceName new() { IncludePosition = IncludePosition.None }); } - [DataTestMethod] + [TestMethod] [DataRow( @" ", diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberAssertsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberAssertsRuleTests.cs index 488b0ccdf65..384d0a4267e 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberAssertsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberAssertsRuleTests.cs @@ -25,7 +25,7 @@ public void LimitShouldBeInFormattedMessage() [DataRow( 1, 33, "assert a% = true", new string[] { "Too many predeployment conditions. Number of 'assert' statements is limited to 32." })] - [DataTestMethod] + [TestMethod] public void TooManyAsserts(int i, int j, string pattern, string[] expectedMessages) { CompileAndTest(GenerateText(i, j, pattern), MaxNumberAssertsRule.Code, Core.Diagnostics.DiagnosticLevel.Error, expectedMessages, new Options() { OnCompileErrors = OnCompileErrors.Ignore }); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberOutputsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberOutputsRuleTests.cs index 9ef0a9fe1b7..adb5399c32f 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberOutputsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberOutputsRuleTests.cs @@ -27,7 +27,7 @@ public void LimitShouldBeInFormattedMessage() [DataRow( 1, 65, "output o% string = 'o%'", new string[] { "Too many outputs. Number of outputs is limited to 64." })] - [DataTestMethod] + [TestMethod] public void TooManyOutputs(int i, int j, string pattern, string[] expectedMessages) { CompileAndTest(GenerateText(i, j, pattern), MaxNumberOutputsRule.Code, Core.Diagnostics.DiagnosticLevel.Error, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberParametersRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberParametersRuleTests.cs index 6cef1489fb7..6bdb9d6fb46 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberParametersRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberParametersRuleTests.cs @@ -27,7 +27,7 @@ public void LimitShouldBeInFormattedMessage() [DataRow( 1, 257, "param p% int = %", new string[] { "Too many parameters. Number of parameters is limited to 256." })] - [DataTestMethod] + [TestMethod] public void TestRule(int i, int j, string pattern, string[] expectedMessages) { CompileAndTest(GenerateText(i, j, pattern), MaxNumberParametersRule.Code, Core.Diagnostics.DiagnosticLevel.Error, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberResourcesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberResourcesRuleTests.cs index 98f4de190d1..e138147da72 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberResourcesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberResourcesRuleTests.cs @@ -32,7 +32,7 @@ public void LimitShouldBeInFormattedMessage() } """, new string[] { "Too many resources. Number of resources is limited to 800." })] - [DataTestMethod] + [TestMethod] public void TooManyResources(int i, int j, string pattern, string[] expectedMessages) { CompileAndTest(GenerateText(i, j, pattern), MaxNumberResourcesRule.Code, Core.Diagnostics.DiagnosticLevel.Error, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberVariablesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberVariablesRuleTests.cs index 7dc56698485..db9f8b2e4fb 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberVariablesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/MaxNumberVariablesRuleTests.cs @@ -39,7 +39,7 @@ public void LimitShouldBeInFormattedMessage() @export() var v% = % ", new string[] { })] - [DataTestMethod] + [TestMethod] public void TooManyVariables(int i, int j, string pattern, string[] expectedMessages) { CompileAndTest(GenerateText(i, j, pattern), MaxNumberVariablesRule.Code, DiagnosticLevel.Error, expectedMessages); @@ -88,7 +88,7 @@ public void TooManyVariablesAfterImport() p1: 'test' } }")] - [DataTestMethod] + [TestMethod] public void TooManyVariablesWithDeploymentSyntax(string deployableSyntaxDeclaration) { var variablesWithExport = GenerateText(2, 514, """ diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoConflictingMetadataRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoConflictingMetadataRuleTests.cs index e334ccbc8f2..776d7d376da 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoConflictingMetadataRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoConflictingMetadataRuleTests.cs @@ -21,7 +21,7 @@ private void CompileAndTest(string text, int expectedDiagnosticCount, Options? o @description('Description set via decorator') param p string """)] - [DataTestMethod] + [TestMethod] public void If_UsesBothMetadataPropertyAndConflictingDecorator_ShouldRaise(string text) { CompileAndTest(text, 1); @@ -33,7 +33,7 @@ public void If_UsesBothMetadataPropertyAndConflictingDecorator_ShouldRaise(strin }) param p string """)] - [DataTestMethod] + [TestMethod] public void If_UsesBothMetadataPropertyWithoutConflictingDecorator_ShouldNotRaise(string text) { CompileAndTest(text, 0); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoDeploymentsResourcesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoDeploymentsResourcesRuleTests.cs index 8758c00033e..79a2ec4e14f 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoDeploymentsResourcesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoDeploymentsResourcesRuleTests.cs @@ -34,7 +34,7 @@ param name string name: name } """)] - [DataTestMethod] + [TestMethod] public void Linter_validation_should_warn_for_nested_deployment_resources(string text) { CompileAndTest(text, 1); @@ -53,7 +53,7 @@ param location string location: location } """)] - [DataTestMethod] + [TestMethod] public void Linter_validation_should_not_warn_for_non_deployment_resource_types(string text) { CompileAndTest(text, 0); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoExplicitAnyRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoExplicitAnyRuleTests.cs index 5118ba6a96e..713449fd260 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoExplicitAnyRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoExplicitAnyRuleTests.cs @@ -20,7 +20,7 @@ public class NoExplicitAnyRuleTests : LinterRuleTestsBase [DataRow("type foo = { prop: any }")] [DataRow("type foo = { *: any }")] [DataRow("type foo = sys.any")] - [DataTestMethod] + [TestMethod] public void Should_raise_diagnostic_when_any_used(string text, int diagnosticCount = 1) => CompileAndTest(text, diagnosticCount); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs index b304cbde69e..a8da88e1e2c 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoHardcodedEnvironmentUrlsRuleTests.cs @@ -76,7 +76,7 @@ param param1 string } } ")] - [DataTestMethod] + [TestMethod] public void Simple(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, text, diagnosticCount, new Options(OnCompileErrors.Ignore)); @@ -97,7 +97,7 @@ param p1 string param p2 string var a = '${p1} azuredatalakestore.net$ {p2}' ")] - [DataTestMethod] + [TestMethod] public void InsideStringInterpolation(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, text, diagnosticCount); @@ -120,13 +120,13 @@ param p1 string param p2 string var a = concat('${p1}${'azuredatalakestore.net'}${p2}${'management.azure.com'}-${'schema.management.azure.com'}', 'foo') ")] - [DataTestMethod] + [TestMethod] public void InsideExpressions(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, text, diagnosticCount, new Options(OnCompileErrors.Ignore)); } - [DataTestMethod] + [TestMethod] // valid matches (i.e., linter rule fails) [DataRow("aschema.management.azure.com", true)] [DataRow("azure.aschema.management.azure.com", true)] @@ -164,7 +164,7 @@ public void DisallowedHostsMatchingTest(string testString, bool isMatch) }); } - [DataTestMethod] + [TestMethod] // valid matches (i.e. it will be excluded and there should be no linter failures) [DataRow("schema.management.azure.com", true)] [DataRow("http://schema.management.azure.com", true)] @@ -226,7 +226,7 @@ param keyVaultUri string [DataRow(1, @" param keyVaultUri string = 'https://.vault.azure.net/keys//' ")] - [DataTestMethod] + [TestMethod] public void ShouldSkipDescriptionAndMetadataDecorators(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(NoHardcodedEnvironmentUrlsRule.Code, text, diagnosticCount, new Options(OnCompileErrors.Ignore)); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoLocationExprOutsideParamsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoLocationExprOutsideParamsRuleTests.cs index a79a791ed20..c72bf832557 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoLocationExprOutsideParamsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoLocationExprOutsideParamsRuleTests.cs @@ -70,7 +70,7 @@ protected void ExpectFailWithFix(string bicepText, string expectedMessage, Expec [DataRow(@" param Location string = az.resourceGroup().location ")] - [DataTestMethod] + [TestMethod] public void If_LocationExprUsedIn_DefaultForParameter_ShouldPass(string text) { ExpectPass(text); @@ -98,7 +98,7 @@ public void If_LocationExprUsedIn_DefaultForParameter_ShouldPass(string text) [DataRow(@" var notAParam = '${az.resourceGroup().properties.provisioningState}' ")] - [DataTestMethod] + [TestMethod] public void If_DeploymentOrResourceGroup_Object_WithoutLocationProperty_ShouldPass(string text) { ExpectPass(text); @@ -131,7 +131,7 @@ public void If_DeploymentOrResourceGroup_Object_WithoutLocationProperty_ShouldPa param notLocation string = ResourceGroup().location ", OnCompileErrors.Ignore)] - [DataTestMethod] + [TestMethod] public void If_Not_DeploymentOrResourceGroup_OrWithIncorrectNamespace_ShouldPass(string text, OnCompileErrors onCompileErrors = OnCompileErrors.IncludeErrors) { ExpectPass(text, new Options(onCompileErrors)); @@ -173,7 +173,7 @@ public void If_Not_DeploymentOrResourceGroup_OrWithIncorrectNamespace_ShouldPass } ", "[4] Use a parameter here instead of 'resourceGroup().location'. 'resourceGroup().location' and 'deployment().location' should only be used as a default value for parameters.")] - [DataTestMethod] + [TestMethod] public void If_DeploymentLocationOrResourceGroup_OutsideParam_ShouldFail(string text, string expectedMessage) { ExpectFail(text, expectedMessage); @@ -197,7 +197,7 @@ public void If_DeploymentLocationOrResourceGroup_OutsideParam_ShouldFail(string } ", "[4] Use a parameter here instead of 'resourceGroup().location'. 'resourceGroup().location' and 'deployment().location' should only be used as a default value for parameters.")] - [DataTestMethod] + [TestMethod] public void If_DeploymentLocationOrResourceGroup_WithAzNamespace_ShouldFail(string text, string expectedMessage) { ExpectFail(text, expectedMessage); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedExistingResourcesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedExistingResourcesRuleTests.cs index a606f516b36..7bbd9623d73 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedExistingResourcesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedExistingResourcesRuleTests.cs @@ -91,7 +91,7 @@ private void CompileAndTest(string text, OnCompileErrors onCompileErrors, params name: 'newApp' } ")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] unusedExistingResources) { CompileAndTest(text, unusedExistingResources); @@ -101,7 +101,7 @@ public void TestRule(string text, params string[] unusedExistingResources) [DataRow(@"resource abc2 'Microsoft.Web/sites@2021-03-01' existing =", "abc2")] [DataRow(@"resource abc3 'Microsoft.Web/sites@2021-03-01' existing = {", "abc3")] [DataRow(@"resource abc4 'Microsoft.Web/sites@2021-03-01' existing = {}", "abc4")] - [DataTestMethod] + [TestMethod] public void SyntaxErrors(string text, params string[] unusedExistingResources) { CompileAndTest(text, OnCompileErrors.Ignore, unusedExistingResources); @@ -110,7 +110,7 @@ public void SyntaxErrors(string text, params string[] unusedExistingResources) [DataRow(@"resource")] [DataRow(@"resource abc1")] [DataRow(@"resource abc1 existing")] - [DataTestMethod] + [TestMethod] public void Errors(string text) { CompileAndTest(text, OnCompileErrors.Ignore); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedImportsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedImportsRuleTests.cs index c4722d8eadb..234a11f5932 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedImportsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedImportsRuleTests.cs @@ -139,7 +139,7 @@ func getString() string => 'exported' func getString() string => 'exported' ", "test")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, string importFileName, string importFileText, params string[] unusedImports) { var additionalFiles = new[] { (importFileName, importFileText) }; @@ -189,7 +189,7 @@ public void TestRule(string text, string importFileName, string importFileText, var unusedparam = 'param' ", "unusedparam")] - [DataTestMethod] + [TestMethod] public void Modules(string text, string importFileName, string importFileText, params string[] unusedImports) { var additionalFiles = new[] { (importFileName, importFileText) }; @@ -225,7 +225,7 @@ public void Modules(string text, string importFileName, string importFileText, p var size = 5 ", "size")] - [DataTestMethod] + [TestMethod] public void Conditions(string text, string importFileName, string importFileText, params string[] unusedImports) { var additionalFiles = new[] { (importFileName, importFileText) }; @@ -320,7 +320,7 @@ func getString() string => 'exported' ", "import { } from './mod.bicep'", "t")] - [DataTestMethod] + [TestMethod] public void Codefix_recommends_remove_unused_imports(string text, string importFileText, string expectedResultText, string importToRemove) { (string FilePath, TestFileData FileData)[] additionalFiles = @@ -337,7 +337,7 @@ private static void AssertCodeFix(string inputFile, string resultFile, string im [DataRow(@"import", "mod.bicep", "")] // Don't show as unused - no imported symbol or file name [DataRow(@"import {p2} from './mod.bicep'", "mod.bicep", "")] // Don't show as unused - imported symbol not existing - [DataTestMethod] + [TestMethod] public void Errors(string text, string importFileName, string importFileText, params string[] unusedImports) { var additionalFiles = new[] { (importFileName, importFileText) }; diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedParametersRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedParametersRuleTests.cs index ab2ac3d2f88..b8d268579a6 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedParametersRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedParametersRuleTests.cs @@ -80,7 +80,7 @@ param p1 param p2 = ", "p1", "p2")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] unusedParams) { CompileAndTest(text, OnCompileErrors.Ignore, unusedParams); @@ -120,7 +120,7 @@ param unusedparam string output storageEndpoint object = stgModule.outputs.storageEndpoint ", "unusedparam")] - [DataTestMethod] + [TestMethod] public void Modules(string text, params string[] unusedParams) { CompileAndTest(text, OnCompileErrors.Ignore, unusedParams); @@ -144,7 +144,7 @@ param size int } ", "size")] - [DataTestMethod] + [TestMethod] public void Conditions(string text, params string[] unusedParams) { CompileAndTest(text, unusedParams); @@ -152,7 +152,7 @@ public void Conditions(string text, params string[] unusedParams) [DataRow(@"param")] // Don't show as unused - no param name [DataRow(@"param // whoops")] // Don't show as unused - no param name - [DataTestMethod] + [TestMethod] public void Errors(string text, params string[] unusedParams) { CompileAndTest(text, OnCompileErrors.Ignore); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedTypesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedTypesRuleTests.cs index c73030b084a..ee1cabd3ca3 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedTypesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedTypesRuleTests.cs @@ -65,7 +65,7 @@ param foo usedType param foo derivedType output bar derivedType = foo ")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] unusedTypes) { CompileAndTest(text, unusedTypes); @@ -87,7 +87,7 @@ public void Exported_types_are_not_reported_as_unused() type a ", "a")] - [DataTestMethod] + [TestMethod] public void SyntaxErrors(string text, params string[] unusedTypes) { CompileAndTest(text, new(OnCompileErrors.Ignore), unusedTypes); @@ -95,7 +95,7 @@ public void SyntaxErrors(string text, params string[] unusedTypes) [DataRow(@"type")] // Don't show as unused - no type name [DataRow(@"type // whoops")] // Don't show as unused - no type name - [DataTestMethod] + [TestMethod] public void Errors(string text, params string[] unusedTypes) { CompileAndTest(text, new(OnCompileErrors.Ignore), unusedTypes); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedVariablesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedVariablesRuleTests.cs index 4f1d0979d83..f90250fa807 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedVariablesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/NoUnusedVariablesRuleTests.cs @@ -73,7 +73,7 @@ private void CompileAndTest(string text, Options options, params string[] unused var sum = 1 + 3 output sub int = sum ")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] unusedVars) { CompileAndTest(text, unusedVars); @@ -96,7 +96,7 @@ var a string resource abc 'Microsoft.AAD/domainServices@2021-03-01' ", "a")] - [DataTestMethod] + [TestMethod] public void SyntaxErrors(string text, params string[] unusedVars) { CompileAndTest(text, new(OnCompileErrors.Ignore), unusedVars); @@ -104,7 +104,7 @@ public void SyntaxErrors(string text, params string[] unusedVars) [DataRow(@"var")] // Don't show as unused - no param name [DataRow(@"var // whoops")] // Don't show as unused - no param name - [DataTestMethod] + [TestMethod] public void Errors(string text, params string[] unusedVars) { CompileAndTest(text, new(OnCompileErrors.Ignore), unusedVars); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/OutputsShouldNotContainSecretsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/OutputsShouldNotContainSecretsRuleTests.cs index 822298ef8ac..a14317d45e4 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/OutputsShouldNotContainSecretsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/OutputsShouldNotContainSecretsRuleTests.cs @@ -60,7 +60,7 @@ param secureParam string ", $"{description} Found possible secret: secure value 'indirection'" )] - [DataTestMethod] + [TestMethod] public void If_OutputReferencesSecureParam_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.IncludeErrors, expectedMessages); @@ -130,7 +130,7 @@ param obj recursiveType ", $"{description} Found possible secret: secure value 'obj.secureProp'" )] - [DataTestMethod] + [TestMethod] public void If_OutputReferencesSecureParamProperty_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.IncludeErrors, expectedMessages); @@ -213,7 +213,7 @@ param p { ", $"{description} Found possible secret: secure value 'p.prop.nestedSecret'" )] - [DataTestMethod] + [TestMethod] public void If_OutputReferencesParamWithSecureProperty_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.IncludeErrors, expectedMessages); @@ -256,7 +256,7 @@ param p { output badResult string = p.prop.nestedInnocuousProperty " )] - [DataTestMethod] + [TestMethod] public void If_OutputReferencesNonSecureParamProperty_ShouldPass(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.IncludeErrors, expectedMessages); @@ -280,7 +280,7 @@ param secureParam string } " )] - [DataTestMethod] + [TestMethod] public void If_ParamNotSecure_ShouldPass(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.IncludeErrors, expectedMessages); @@ -322,7 +322,7 @@ param storageName string } " )] - [DataTestMethod] + [TestMethod] public void If_ListFunctionInOutput_AsResourceMethod_ShouldPass(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.Ignore, expectedMessages); @@ -343,7 +343,7 @@ param storageName string ", $"{description} Found possible secret: function 'listAnything'" )] - [DataTestMethod] + [TestMethod] public void If_ListFunctionInOutput_AsResourceMethod_ThroughVariable_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.Ignore, expectedMessages); @@ -377,7 +377,7 @@ param storageName string // Output contains secret: badResult $"{description} Found possible secret: function 'listAnything'" )] - [DataTestMethod] + [TestMethod] public void If_ListFunctionInOutput_AsStandaloneFunction_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.Ignore, expectedMessages); @@ -397,7 +397,7 @@ param storageName string // Output contains secret: badResult $"{description} Found possible secret: function 'listAnything'" )] - [DataTestMethod] + [TestMethod] public void If_ListFunctionInOutput_AsAzInstanceFunction_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.Ignore, expectedMessages); @@ -426,7 +426,7 @@ public void If_ListFunctionInOutput_AsAzInstanceFunction_ShouldFail(string text, ", $"{description} Found possible secret: output name 'passwordNumber1' suggests a secret" )] - [DataTestMethod] + [TestMethod] public void If_OutputNameLooksLikePassword_ShouldFail(string text, params string[] expectedMessages) { CompileAndTest(text, OnCompileErrors.Ignore, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferInterpolationRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferInterpolationRuleTests.cs index f400ffe7585..871a3a91a00 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferInterpolationRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferInterpolationRuleTests.cs @@ -51,7 +51,7 @@ private void ExpectDiagnosticWithFix(string text, string[] expectedFixes, Option ", "'vnet-${suffix}'" )] - [DataTestMethod] + [TestMethod] public void VariableValue_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -66,7 +66,7 @@ public void VariableValue_HasFix(string text, string expectedFix) ", "'vnet-${suffix}'" )] - [DataTestMethod] + [TestMethod] public void ParameterValue_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -81,7 +81,7 @@ public void ParameterValue_HasFix(string text, string expectedFix) ", "'vnet-${suffix}'" )] - [DataTestMethod] + [TestMethod] public void ResourceProperty_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -100,7 +100,7 @@ param p2 string ", "'${p1}${p2}'" )] - [DataTestMethod] + [TestMethod] public void ResourceDeepProperty_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -123,7 +123,7 @@ param projectName string ", "'${projectName}main'" )] - [DataTestMethod] + [TestMethod] public void ConcatDeepInExpression_HasFix(string text, params string[] expectedFixes) { ExpectDiagnosticWithFix(text, expectedFixes); @@ -139,7 +139,7 @@ public void ConcatDeepInExpression_HasFix(string text, params string[] expectedF ", "'abcdefghi'" )] - [DataTestMethod] + [TestMethod] public void JustLiterals_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -180,7 +180,7 @@ public void JustLiterals_HasFix(string text, string expectedFix) ", "'a${v1}b${v2}'" )] - [DataTestMethod] + [TestMethod] public void MixedLiteralsAndExpressions_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -224,7 +224,7 @@ public void MixedLiteralsAndExpressions_HasFix(string text, string expectedFix) ", "'${a}${b}${uniqueString('${a}')}'" )] - [DataTestMethod] + [TestMethod] public void StringFolding_HasFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -333,7 +333,7 @@ var b var b = concat(a1, a2, a3, a4) // arrays - no interpolate recommended " )] - [DataTestMethod] + [TestMethod] public void ArgsNotStrings_DoNotSuggestFix(string text, OnCompileErrors onCompileErrors = OnCompileErrors.IncludeErrors) { ExpectPass(text, onCompileErrors); @@ -378,7 +378,7 @@ module abc concat('a', 'b') = { ", "'ab'" )] - [DataTestMethod] + [TestMethod] public void HandlesSyntaxErrors(string text, string? expectedFix) { if (expectedFix == null) @@ -400,7 +400,7 @@ public void HandlesSyntaxErrors(string text, string? expectedFix) var b = concat(a) // by definition concat must have multiple arguments before we recommend interpolation " )] - [DataTestMethod] + [TestMethod] public void SingleArgs_DontSuggestFix(string text) { ExpectPass(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferUnquotedPropertyNamesRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferUnquotedPropertyNamesRuleTests.cs index 86b7102d4bf..6c9e243334b 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferUnquotedPropertyNamesRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/PreferUnquotedPropertyNamesRuleTests.cs @@ -53,7 +53,7 @@ private void ExpectDiagnosticWithFix(string text, string expectedFix) }", "myProp1" )] - [DataTestMethod] + [TestMethod] public void ObjectPropertyDeclaration(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -71,7 +71,7 @@ public void ObjectPropertyDeclaration(string text, string expectedFix) 'my-property': {} }" )] - [DataTestMethod] + [TestMethod] public void ObjectPropertyDeclaration_NotValidIdentifier(string text) { ExpectPass(text); @@ -89,7 +89,7 @@ public void ObjectPropertyDeclaration_NotValidIdentifier(string text) myProperty: {} }" )] - [DataTestMethod] + [TestMethod] public void ObjectPropertyDeclaration_AlreadyBare(string text) { ExpectPass(text); @@ -113,7 +113,7 @@ param AnObject object var v1 = AnObject['myProp1']", ".myProp1" )] - [DataTestMethod] + [TestMethod] public void ObjectPropertyDereference(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -129,7 +129,7 @@ param AnObject object param AnObject object var v1 = AnObject['my-property']" )] - [DataTestMethod] + [TestMethod] public void ObjectPropertyDereference_NotValidIdentifier(string text) { ExpectPass(text); @@ -144,7 +144,7 @@ param AutomationAccountLocation string location: AutomationAccountLocation }" )] - [DataTestMethod] + [TestMethod] public void NoPropertyDeclarationOrDereference_Passes(string text) { ExpectPass(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecretsInParamsMustBeSecureTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecretsInParamsMustBeSecureTests.cs index 66b3651d4b2..a35257d9476 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecretsInParamsMustBeSecureTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecretsInParamsMustBeSecureTests.cs @@ -53,7 +53,7 @@ private void CompileAndTest(string bicep, int numberOfExpectedErrors) [DataRow(@"@secure() param password string")] [DataRow(@"param key string")] - [DataTestMethod] + [TestMethod] public void ExpectingPass(string bicep) { CompileAndTest(bicep, 0); @@ -68,7 +68,7 @@ public void ExpectingPass(string bicep) param password string", true)] [DataRow(@"@secure() param password object", true)] - [DataTestMethod] + [TestMethod] public void ShouldOnlyFailForStringAndObject(string bicep, bool shouldPass) { CompileAndTest(bicep, shouldPass ? 0 : 1); @@ -119,7 +119,7 @@ public void ExpectingFail(string bicep) [DataRow(true, @"param pass_secretname string")] [DataRow(true, @"param pass_keyVaultSecretName object")] [DataRow(false, @"param fail_secretNombre string")] - [DataTestMethod] + [TestMethod] public void AllowedListExceptions(bool shouldPass, string bicep) { CompileAndTest(bicep, shouldPass ? 0 : 1); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecureParameterDefaultRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecureParameterDefaultRuleTests.cs index fdfc77206d2..11cef29bcf4 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecureParameterDefaultRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SecureParameterDefaultRuleTests.cs @@ -17,7 +17,7 @@ public class SecureParameterDefaultRuleTests : LinterRuleTestsBase var sum = 1 + 3 output sub int = sum ")] - [DataTestMethod] + [TestMethod] public void NotSecureParam_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -33,7 +33,7 @@ param password string @secure() param poNoDefault object ")] - [DataTestMethod] + [TestMethod] public void NoDefault_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -43,7 +43,7 @@ public void NoDefault_TestPasses(int diagnosticCount, string text) @secure() param password string = '' ")] - [DataTestMethod] + [TestMethod] public void EmptyString_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -53,7 +53,7 @@ public void EmptyString_TestPasses(int diagnosticCount, string text) @secure() param poEmpty object = {} ")] - [DataTestMethod] + [TestMethod] public void EmptyObject_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -68,7 +68,7 @@ param psEmpty string @secure() param psContainsNewGuid string = concat('${psEmpty}${newGuid()})', '') ")] - [DataTestMethod] + [TestMethod] public void ExpressionContainingNewGuid_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -131,7 +131,7 @@ param param3 int @secure() param psExpression string = resourceGroup().location ")] - [DataTestMethod] + [TestMethod] public void InvalidNonEmptyDefault_TestFails(int diagnosticCount, string text, OnCompileErrors onCompileErrors = OnCompileErrors.IncludeErrors) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount, new Options(onCompileErrors)); @@ -143,7 +143,7 @@ public void InvalidNonEmptyDefault_TestFails(int diagnosticCount, string text, O abc: 1 } ")] - [DataTestMethod] + [TestMethod] public void NonEmptySecureObject_TestFails(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); @@ -195,7 +195,7 @@ param param3 int @secure() output sub int = sum ")] - [DataTestMethod] + [TestMethod] public void HandlesSyntaxErrors(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount, new Options(OnCompileErrors.Ignore)); @@ -222,7 +222,7 @@ param param1 string @secure() param param2 string = param1 ")] - [DataTestMethod] + [TestMethod] public void ParameterReassignment_TestPasses(int diagnosticCount, string text) { AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyInterpolationRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyInterpolationRuleTests.cs index 185f462bd77..4ceeb5d9642 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyInterpolationRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyInterpolationRuleTests.cs @@ -80,7 +80,7 @@ param ssVal string ", "ssVal" )] - [DataTestMethod] + [TestMethod] public void ParameterReference(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -107,7 +107,7 @@ public void ParameterReference(string text, string expectedFix) ", "ssVal" )] - [DataTestMethod] + [TestMethod] public void VariableReference(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -130,7 +130,7 @@ public void VariableReference(string text, string expectedFix) }", "resourceGroup().location" )] - [DataTestMethod] + [TestMethod] public void StringExpression(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -164,7 +164,7 @@ param AutomationAccountName string location: resourceGroup().location }" )] - [DataTestMethod] + [TestMethod] public void InterpolationMoreThanJustParamOrVar_Passes(string text) { ExpectPass(text); @@ -177,7 +177,7 @@ param AutomationAccountName string location: resourceGroup().location }" )] - [DataTestMethod] + [TestMethod] public void DoesntHaveInterpolation_Passes(string text) { ExpectPass(text); @@ -217,7 +217,7 @@ param currentTime string } " )] - [DataTestMethod] + [TestMethod] public void StringInterpolationInsidePropertyNames_Passes(string text) { ExpectPass(text); @@ -257,7 +257,7 @@ public void StringInterpolationInsidePropertyNames_Passes(string text) [DataRow(@" var stringVal = '${resourceGroup().tags}' ")] - [DataTestMethod] + [TestMethod] public void TypeIsNotString_Passes(string text) { ExpectPass(text); @@ -280,7 +280,7 @@ param untypedParam // syntax error var stringVal = '${untypedParam}' " )] - [DataTestMethod] + [TestMethod] public void SyntaxErrors_ExpectNoFixes(string text) { ExpectPass(text, new Options(OnCompileErrors.Ignore)); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyJsonNullRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyJsonNullRuleTests.cs index 2063f22036c..18c1d0c1061 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyJsonNullRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/SimplifyJsonNullRuleTests.cs @@ -78,7 +78,7 @@ private void ExpectDiagnosticWithFix(string text, string expectedFix) ", "null" )] - [DataTestMethod] + [TestMethod] public void Rule_ProducesDiagnosticWithFix(string text, string expectedFix) { ExpectDiagnosticWithFix(text, expectedFix); @@ -90,7 +90,7 @@ public void DoesntHaveJsonNull_Passes() ExpectPass("var test = 'test'"); } - [DataTestMethod] + [TestMethod] [DataRow( @" var a = json(null) diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/StacksExtensibilityCompatibilityRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/StacksExtensibilityCompatibilityRuleTests.cs index 3913fa315a7..1f47dab829e 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/StacksExtensibilityCompatibilityRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/StacksExtensibilityCompatibilityRuleTests.cs @@ -24,7 +24,7 @@ public class StacksExtensibilityCompatibilityRuleTests : LinterRuleTestsBase public TestContext TestContext { get; set; } = null!; - [DataTestMethod] + [TestMethod] [DataRow( "ValidSecurePropertyAssignment", "extensionConfig mockExt with { secureStringRequiredProp: az.getSecret('a', 'b', 'c', 'd'), stringRequiredProp: 'value' }", @@ -48,7 +48,7 @@ public async Task Does_not_flag_stack_compatible_assignments(string scenario, st } // NOTE: BCP180/getSecret validation covers assigning key vault references to non-secure properties. - [DataTestMethod] + [TestMethod] [DataRow( "InlinedSecretsAreFlagged", "extensionConfig mockExt with { secureStringRequiredProp: 'SECRET', stringRequiredProp: 'value' }", diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionOutputRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionOutputRuleTests.cs index d7b93e358e5..ba719ff829e 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionOutputRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionOutputRuleTests.cs @@ -72,7 +72,7 @@ public void Outputs_without_descriptions_are_reported() @sys.description('Output description.') output result string = 'value' """)] - [DataTestMethod] + [TestMethod] public void Non_empty_descriptions_are_accepted(string text) { AssertNoDiagnostics(text); @@ -92,7 +92,7 @@ public void Non_empty_descriptions_are_accepted(string text) ''') output result string = 'value' """)] - [DataTestMethod] + [TestMethod] public void Empty_and_whitespace_descriptions_are_reported(string text) { AssertDiagnostics(text); @@ -117,7 +117,7 @@ param input string @description('Variable description.') var value = 'value' """)] - [DataTestMethod] + [TestMethod] public void Descriptions_on_other_declarations_are_ignored(string text) { AssertNoDiagnostics(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionParametersRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionParametersRuleTests.cs index 4201771ce8f..97824722691 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionParametersRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionParametersRuleTests.cs @@ -72,7 +72,7 @@ param input string @sys.description('Parameter description.') param input string """)] - [DataTestMethod] + [TestMethod] public void Non_empty_descriptions_are_accepted(string text) { AssertNoDiagnostics(text); @@ -96,7 +96,7 @@ param input string ''') param input string """)] - [DataTestMethod] + [TestMethod] public void Empty_and_whitespace_descriptions_are_reported(string text) { AssertDiagnostics(text); @@ -121,7 +121,7 @@ param input string @description('Output description.') output result string = 'value' """)] - [DataTestMethod] + [TestMethod] public void Descriptions_on_other_declarations_are_ignored(string text) { AssertNoDiagnostics(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypePropertyRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypePropertyRuleTests.cs index 7803998bd1e..f604a19ec67 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypePropertyRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypePropertyRuleTests.cs @@ -82,7 +82,7 @@ public void Properties_without_descriptions_are_reported() name: string } """)] - [DataTestMethod] + [TestMethod] public void Non_empty_descriptions_are_accepted(string text) { AssertNoDiagnostics(text); @@ -102,7 +102,7 @@ public void Non_empty_descriptions_are_accepted(string text) name: string } """)] - [DataTestMethod] + [TestMethod] public void Empty_and_whitespace_descriptions_are_reported(string text) { AssertDiagnostics(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypeRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypeRuleTests.cs index debba601e2b..eb201a4b900 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypeRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionTypeRuleTests.cs @@ -76,7 +76,7 @@ public void Types_without_descriptions_are_reported() @sys.description('Type description.') type myType = string """)] - [DataTestMethod] + [TestMethod] public void Non_empty_descriptions_are_accepted(string text) { AssertNoDiagnostics(text); @@ -92,7 +92,7 @@ public void Non_empty_descriptions_are_accepted(string text) @description(' ') type myType = string """)] - [DataTestMethod] + [TestMethod] public void Empty_and_whitespace_descriptions_are_reported(string text) { AssertDiagnostics(text); @@ -120,7 +120,7 @@ param input string @description('Output description.') output result string = 'value' """)] - [DataTestMethod] + [TestMethod] public void Descriptions_on_other_declarations_are_ignored(string text) { AssertNoDiagnostics(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionVarsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionVarsRuleTests.cs index 728840dc031..9537115febf 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionVarsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseDescriptionVarsRuleTests.cs @@ -72,7 +72,7 @@ public void Variables_without_descriptions_are_reported() @sys.description('Variable description.') var input = 'value' """)] - [DataTestMethod] + [TestMethod] public void Non_empty_descriptions_are_accepted(string text) { AssertNoDiagnostics(text); @@ -96,7 +96,7 @@ public void Non_empty_descriptions_are_accepted(string text) ''') var input = 'value' """)] - [DataTestMethod] + [TestMethod] public void Empty_and_whitespace_descriptions_are_reported(string text) { AssertDiagnostics(text); @@ -120,7 +120,7 @@ param input string @description('Output description.') output result string = 'value' """)] - [DataTestMethod] + [TestMethod] public void Descriptions_on_other_declarations_are_ignored(string text) { AssertNoDiagnostics(text); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRuleTests.cs index 78460fcf974..6173fdce078 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRuleTests.cs @@ -989,8 +989,8 @@ private static bool DateIsEqualOrMoreRecentThan(DateOnly dt, DateOnly other) return dt.CompareTo(other) >= 0; } - [DataTestMethod] - [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(TestData), DynamicDataDisplayName = nameof(TestData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetTestData), DynamicDataDisplayNameDeclaringType = typeof(TestData), DynamicDataDisplayName = nameof(TestData.GetDisplayName))] public void InvariantsTest(TestData data) { var (allVersions, allowedVersions) = UseRecentApiVersionRule.GetAcceptableApiVersions(RealApiVersionProvider, data.Today, data.MaxAgeInDays, UseRecentApiVersionRule.DefaultGracePeriodInDays, data.ResourceScope, data.FullyQualifiedResourceType); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRule_InReferenceFunctions_Tests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRule_InReferenceFunctions_Tests.cs index f14bcf5532f..98bb9f80304 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRule_InReferenceFunctions_Tests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseRecentApiVersionRule_InReferenceFunctions_Tests.cs @@ -164,7 +164,7 @@ param apiversion string "Fake.Resources/deployments", "2415-01-01" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_Reference_NoResourceId(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -227,7 +227,7 @@ public void GetFunctionCallInfo_Reference_NoResourceId(string bicep, string expe "Fake.Network/virtualNetworks/subnets", "2415-06-15" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_Reference_ResourceId(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -256,7 +256,7 @@ public void GetFunctionCallInfo_Reference_ResourceId(string bicep, string expect "Fake.Network/publicIPAddresses", "2415-06-15" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_List_ResourceId(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -338,7 +338,7 @@ public void GetFunctionCallInfo_List_ResourceId(string bicep, string expectedFun "2417-12-01-preview", DisplayName = "string expression" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_UsingNameOfResource(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -391,7 +391,7 @@ public void GetFunctionCallInfo_UsingNameOfResource(string bicep, string expecte // "2415-08-31-preview", // DisplayName = "Symbolic reference id through variable" //)] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_UsingResourceSymbolicReferenceId(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -431,7 +431,7 @@ public void GetFunctionCallInfo_UsingResourceSymbolicReferenceId(string bicep, s "Fake.Compute/virtualMachineScaleSets/virtualMachines/runCommands", "2420-06-01" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_PartsBeyondResourceType(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); @@ -501,7 +501,7 @@ public void GetFunctionCallInfo_PartsBeyondResourceType(string bicep, string exp "Fake.Compute/virtualMachineScaleSets", "2420-06-01" )] - [DataTestMethod] + [TestMethod] public void GetFunctionCallInfo_OptionalSubscriptionIdResourceIdArguments(string bicep, string expectedFunctionCall, string? expectedResourceType, string? expectedApiVerion) { TestGetFunctionCallInfo(bicep, expectedFunctionCall, expectedResourceType, expectedApiVerion); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseResourceIdFunctionsRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseResourceIdFunctionsRuleTests.cs index 1eb9a864b4b..1bda8320a94 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseResourceIdFunctionsRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseResourceIdFunctionsRuleTests.cs @@ -1669,7 +1669,7 @@ param acrPullMIClientIds string[] }, DisplayName = "managementGroupResourceId" )] - [DataTestMethod] + [TestMethod] public void Test(string text, string[] expectedMessages) { CompileAndTest(text, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableResourceIdentifiersRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableResourceIdentifiersRuleTests.cs index e21f60af534..e27c2b263d6 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableResourceIdentifiersRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableResourceIdentifiersRuleTests.cs @@ -143,7 +143,7 @@ func newGuid() string => "abc" } } """)] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] expectedMessages) { CompileAndTest(text, expectedMessages); diff --git a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableVMImageRuleTests.cs b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableVMImageRuleTests.cs index 8fa5e4eabf4..42bcff14e12 100644 --- a/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableVMImageRuleTests.cs +++ b/src/Bicep.Core.UnitTests/Diagnostics/LinterRuleTests/UseStableVMImageRuleTests.cs @@ -122,7 +122,7 @@ private void CompileAndTest(string text, params string[] useStableVMImage) } } }", "offer", "version")] - [DataTestMethod] + [TestMethod] public void TestRule(string text, params string[] useRecentApiVersions) { CompileAndTest(text, useRecentApiVersions); diff --git a/src/Bicep.Core.UnitTests/Emit/ExpressionConverterTests.cs b/src/Bicep.Core.UnitTests/Emit/ExpressionConverterTests.cs index 831032eb82a..a139dac136f 100644 --- a/src/Bicep.Core.UnitTests/Emit/ExpressionConverterTests.cs +++ b/src/Bicep.Core.UnitTests/Emit/ExpressionConverterTests.cs @@ -16,7 +16,7 @@ public class ExpressionConverterTests private static TestCompiler CreateCompiler() => TestCompiler.ForInMemoryCompilation() .WithEmptyAzResources(); - [DataTestMethod] + [TestMethod] [DataRow("null", "[null()]")] [DataRow("true", "[true()]")] [DataRow("false", "[false()]")] diff --git a/src/Bicep.Core.UnitTests/Emit/InlineDependencyVisitorTests.cs b/src/Bicep.Core.UnitTests/Emit/InlineDependencyVisitorTests.cs index 06c1abd611a..f406b11ce96 100644 --- a/src/Bicep.Core.UnitTests/Emit/InlineDependencyVisitorTests.cs +++ b/src/Bicep.Core.UnitTests/Emit/InlineDependencyVisitorTests.cs @@ -41,7 +41,7 @@ public void VisitorShouldCalculateInliningInBulk() } [DataRow("things")] - [DataTestMethod] + [TestMethod] public void VisitorShouldProduceNoChainForNonInlinedVariables(string variableName) { var compilation = CreateCompiler().CompileWithoutRestore(Text).Compilation; @@ -55,7 +55,7 @@ public void VisitorShouldProduceNoChainForNonInlinedVariables(string variableNam [DataRow("indirection", "keys")] [DataRow("runtimeLoop", "indirection,keys")] [DataRow("runtimeLoop2", "indirection,keys")] - [DataTestMethod] + [TestMethod] public void VisitorShouldProduceCorrectChainForInlinedVariables(string variableName, string expectedChain) { var compilation = CreateCompiler().CompileWithoutRestore(Text).Compilation; diff --git a/src/Bicep.Core.UnitTests/Extensions/IFileHandleExtensionsTests.cs b/src/Bicep.Core.UnitTests/Extensions/IFileHandleExtensionsTests.cs index 8c868ab01e1..3b380521d12 100644 --- a/src/Bicep.Core.UnitTests/Extensions/IFileHandleExtensionsTests.cs +++ b/src/Bicep.Core.UnitTests/Extensions/IFileHandleExtensionsTests.cs @@ -20,7 +20,7 @@ namespace Bicep.Core.UnitTests.Extensions [TestClass] public class IFileHandleExtensionsTests { - [DataTestMethod] + [TestMethod] [DataRow("/main.json", true)] [DataRow("/main.jsonc", true)] [DataRow("/main.arm", true)] @@ -38,7 +38,7 @@ public void IsArmTemplateLikeFile_VariousExtensions_ReturnsExpectedResult(string result.Should().Be(expectedResult); } - [DataTestMethod] + [TestMethod] [DataRow("/main.bicep", true)] [DataRow("/main.txt", false)] public void IsBicepFile_VariousExtensions_ReturnsExpectedResult(string filePath, bool expectedResult) @@ -54,7 +54,7 @@ public void IsBicepFile_VariousExtensions_ReturnsExpectedResult(string filePath, result.Should().Be(expectedResult); } - [DataTestMethod] + [TestMethod] [DataRow("/main.bicepparam", true)] [DataRow("/main.txt", false)] public void IsBicepParamsFile_VariousExtensions_ReturnsExpectedResult(string filePath, bool expectedResult) @@ -70,7 +70,7 @@ public void IsBicepParamsFile_VariousExtensions_ReturnsExpectedResult(string fil result.Should().Be(expectedResult); } - [DataTestMethod] + [TestMethod] [DataRow("Peek at this contents", 5, "Peek ")] [DataRow("Short", 10, "Short")] public void TryPeek_PositiveLength_ReturnsContentsUpToLength(string contents, int length, string expectedContents) diff --git a/src/Bicep.Core.UnitTests/Extensions/StringExtensionsTests.cs b/src/Bicep.Core.UnitTests/Extensions/StringExtensionsTests.cs index 753b986c365..26f2adc97a9 100644 --- a/src/Bicep.Core.UnitTests/Extensions/StringExtensionsTests.cs +++ b/src/Bicep.Core.UnitTests/Extensions/StringExtensionsTests.cs @@ -34,7 +34,7 @@ public class StringExtensionsTests "^br:(?.+?)/(?.+?)[:@](?.+?)$", new string[] { "repo", "registry", "tag" }, new string[] { "test/module1", "mockregistry.io", "v1" })] - [DataTestMethod] + [TestMethod] public void ExtractRegexGroups_ByGroupNames_Valid(string s, string regex, string[] groupNames, string[] expected) { var result = s.ExtractRegexGroups(regex, groupNames); @@ -46,10 +46,10 @@ public void ExtractRegexGroups_ByGroupNames_Valid(string s, string regex, string "(?:\\w)", new string[] { "one" }, "No matches were found for regex (?:\\w) in string \"hello there\"")] - [DataTestMethod] + [TestMethod] public void ExtractRegexGroups_ByGroupNames_Invalid(string s, string regex, string[] groupNames, string expectedError) { - var ex = Assert.ThrowsException(() => s.ExtractRegexGroups(regex, groupNames)); + var ex = Assert.Throws(() => s.ExtractRegexGroups(regex, groupNames)); ex.Message.Should().Be(nameof(StringExtensions.ExtractRegexGroups) + ": " + expectedError); } @@ -69,7 +69,7 @@ public void ExtractRegexGroups_ByGroupNames_Invalid(string s, string regex, stri "br:mockregistry.io/test/module1:v1", "^br:(?.+?)/(?.+?)[:@](?.+?)$", new string[] { "mockregistry.io", "test/module1", "v1" })] - [DataTestMethod] + [TestMethod] public void ExtractRegexGroups_AllGroups_Valid(string s, string regex, string[] expected) { var result = s.ExtractRegexGroups(regex); @@ -88,10 +88,10 @@ public void ExtractRegexGroups_AllGroups_Valid(string s, string regex, string[] "123456789", "[0-9]+", "No groups were found in regex [0-9]+")] - [DataTestMethod] + [TestMethod] public void ExtractRegexGroups_AllGroups_Invalid(string s, string regex, string expectedError) { - var ex = Assert.ThrowsException(() => s.ExtractRegexGroups(regex)); + var ex = Assert.Throws(() => s.ExtractRegexGroups(regex)); ex.Message.Should().Be(nameof(StringExtensions.ExtractRegexGroups) + ": " + expectedError); } } diff --git a/src/Bicep.Core.UnitTests/FileSystem/PathHelperTests.cs b/src/Bicep.Core.UnitTests/FileSystem/PathHelperTests.cs index 595916d3ec0..e2cd989d7d3 100644 --- a/src/Bicep.Core.UnitTests/FileSystem/PathHelperTests.cs +++ b/src/Bicep.Core.UnitTests/FileSystem/PathHelperTests.cs @@ -21,7 +21,7 @@ public void LinuxFileSystem_ShouldBeCaseSensitive() PathHelper.PathComparer.Should().BeSameAs(StringComparer.Ordinal); } - [DataTestMethod] + [TestMethod] [DataRow("foo.json")] public void GetBuildOutputPath_ShouldThrowOnJsonExtensions_Linux(string path) { @@ -29,7 +29,7 @@ public void GetBuildOutputPath_ShouldThrowOnJsonExtensions_Linux(string path) badExtension.Should().Throw().WithMessage("The specified file already has the '.json' extension."); } - [DataTestMethod] + [TestMethod] [DataRow("foo.bicep")] public void GetDecompileOutputPath_ShouldThrowOnBicepExtensions_Linux(string path) { @@ -44,7 +44,7 @@ public void WindowsAndMacFileSystem_ShouldBeCaseInsensitive() PathHelper.PathComparer.Should().BeSameAs(StringComparer.OrdinalIgnoreCase); } - [DataTestMethod] + [TestMethod] [DataRow("foo.json")] [DataRow("foo.JSON")] [DataRow("foo.JsOn")] @@ -54,7 +54,7 @@ public void GetBuildOutputPath_ShouldThrowOnJsonExtensions_WindowsAndMac(string badExtension.Should().Throw().WithMessage("The specified file already has the '.json' extension."); } - [DataTestMethod] + [TestMethod] [DataRow("foo.bicep")] [DataRow("foo.BICEP")] [DataRow("foo.BiCeP")] @@ -65,29 +65,29 @@ public void GetDecompileOutputPath_ShouldThrowOnBicepExtensions_WindowsAndMac(st } #endif - [DataTestMethod] - [DynamicData(nameof(GetResolvePathData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetResolvePathData), DynamicDataDisplayName = nameof(GetDisplayName))] public void ResolvePath_ShouldResolveCorrectly(string path, string expectedPath) { PathHelper.ResolvePath(path).Should().Be(expectedPath); } - [DataTestMethod] - [DynamicData(nameof(GetFilePathToFileUrlData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetFilePathToFileUrlData), DynamicDataDisplayName = nameof(GetDisplayName))] public void FilePathToFileUrl_ShouldResolveCorrectly(string path, string expectedPath) { PathHelper.FilePathToFileUrl(path).LocalPath.Should().Be(expectedPath); } - [DataTestMethod] - [DynamicData(nameof(GetBuildOutputPathData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetBuildOutputPathData), DynamicDataDisplayName = nameof(GetDisplayName))] public void GetDefaultBuildOutputPath_ShouldChangeExtensionCorrectly(string path, string expectedPath) { PathHelper.GetJsonOutputPath(path).Should().Be(expectedPath); } - [DataTestMethod] - [DynamicData(nameof(GetDecompileOutputPathData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetDecompileOutputPathData), DynamicDataDisplayName = nameof(GetDisplayName))] public void GetDefaultDecompileOutputPath_ShouldChangeExtensionCorrectly(string path, string expectedPath) { PathHelper.GetBicepOutputPath(path).Should().Be(expectedPath); diff --git a/src/Bicep.Core.UnitTests/Modules/ArtifactAddressComponentsTests.cs b/src/Bicep.Core.UnitTests/Modules/ArtifactAddressComponentsTests.cs index 99662d7682c..e4223f155ce 100644 --- a/src/Bicep.Core.UnitTests/Modules/ArtifactAddressComponentsTests.cs +++ b/src/Bicep.Core.UnitTests/Modules/ArtifactAddressComponentsTests.cs @@ -66,8 +66,8 @@ public void ExamplesShouldMatchExpectedConstraints() ExampleRegistryOfMaxLength.Should().HaveLength(255); } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferenceShouldBeEqualToItself(ValidCase @case) { OciArtifactAddressComponents first = Parse(@case.Value); @@ -75,8 +75,8 @@ public void ValidReferenceShouldBeEqualToItself(ValidCase @case) VerifyEqual(first, second); } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferenceShouldBeEqualWithCaseChanged(ValidCase @case) { OciArtifactAddressComponents first = Parse(@case.Value); @@ -88,8 +88,8 @@ public void ValidReferenceShouldBeEqualWithCaseChanged(ValidCase @case) VerifyEqual(firstLower, firstUpper); } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void CharacterChanged_ShouldNotBeEqual(ValidCase @case) { string ModifyCharAt(string a, int index) diff --git a/src/Bicep.Core.UnitTests/Modules/LocalModuleReferenceTests.cs b/src/Bicep.Core.UnitTests/Modules/LocalModuleReferenceTests.cs index 279221cf650..73573a8005a 100644 --- a/src/Bicep.Core.UnitTests/Modules/LocalModuleReferenceTests.cs +++ b/src/Bicep.Core.UnitTests/Modules/LocalModuleReferenceTests.cs @@ -16,7 +16,7 @@ public class LocalModuleReferenceTests [DataRow("test.bicep", "test.bicep")] [DataRow("../bar/foo.bicep", "../bar/foo.bicep")] [DataRow("./t.json", "./t.json")] - [DataTestMethod] + [TestMethod] public void SameModulePathsShouldBeEqual(string package1, string package2) { var (first, second) = ParsePair(package1, package2); @@ -28,7 +28,7 @@ public void SameModulePathsShouldBeEqual(string package1, string package2) [DataRow("test.bicep", "Test.bicep")] [DataRow("../bar/foo.bicep", "foo.bicep")] [DataRow("./t.json", "./t.JSON")] - [DataTestMethod] + [TestMethod] public void DifferentPathsShouldNotBeEqual(string package1, string package2) { var (first, second) = ParsePair(package1, package2); @@ -40,7 +40,7 @@ public void DifferentPathsShouldNotBeEqual(string package1, string package2) [DataRow("./test.bicep")] [DataRow("foo/bar/test.bicep")] [DataRow("../bar/test.bicep")] - [DataTestMethod] + [TestMethod] public void TryParseModuleReference_ValidLocalReference_ShouldParse(string value) { var reference = Parse(value); diff --git a/src/Bicep.Core.UnitTests/Modules/ModuleReferenceTests.cs b/src/Bicep.Core.UnitTests/Modules/ModuleReferenceTests.cs index f63aef2b331..2610c4ea2f5 100644 --- a/src/Bicep.Core.UnitTests/Modules/ModuleReferenceTests.cs +++ b/src/Bicep.Core.UnitTests/Modules/ModuleReferenceTests.cs @@ -22,8 +22,8 @@ public void ModuleReferenceShouldBeDerivedAtLeastOnce() subClasses.Should().Contain(item => (Type)item[0] == typeof(LocalModuleReference)); } - [DataTestMethod] - [DynamicData(nameof(GetModuleRefSubClasses), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet))] + [TestMethod] + [DynamicData(nameof(GetModuleRefSubClasses), DynamicDataDisplayNameDeclaringType = typeof(DataSet))] public void ModuleRefSubClassesShouldOverrideEqualsAndHashCode(Type type) { /* diff --git a/src/Bicep.Core.UnitTests/Modules/OciArtifactModuleReferenceTests.cs b/src/Bicep.Core.UnitTests/Modules/OciArtifactModuleReferenceTests.cs index 2827679e19e..3b4734aae93 100644 --- a/src/Bicep.Core.UnitTests/Modules/OciArtifactModuleReferenceTests.cs +++ b/src/Bicep.Core.UnitTests/Modules/OciArtifactModuleReferenceTests.cs @@ -58,14 +58,14 @@ private static void VerifyNotEqual(OciArtifactReference first, OciArtifactRefere first.GetHashCode().Should().NotBe(secondAsObject.GetHashCode()); } - [DynamicData(nameof(ArtifactAddressComponentsTests.GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(ArtifactAddressComponentsTests.GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferencesShouldParseCorrectly(ArtifactAddressComponentsTests.ValidCase @case) { var parsed = Parse(@case.Value); using (new AssertionScope()) - { + { parsed.Registry.Should().Be(@case.ExpectedRegistry); parsed.Repository.Should().Be(@case.ExpectedRepository); parsed.Tag.Should().Be(@case.ExpectedTag); @@ -75,8 +75,8 @@ public void ValidReferencesShouldParseCorrectly(ArtifactAddressComponentsTests.V } } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferenceShouldBeEqualToItself(ArtifactAddressComponentsTests.ValidCase @case) { OciArtifactReference first = Parse(@case.Value); @@ -84,8 +84,8 @@ public void ValidReferenceShouldBeEqualToItself(ArtifactAddressComponentsTests.V VerifyEqual(first, second); } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferenceShouldBeEqualWithCaseChanged(ArtifactAddressComponentsTests.ValidCase @case) { OciArtifactReference first = Parse(@case.Value); @@ -97,30 +97,30 @@ public void ValidReferenceShouldBeEqualWithCaseChanged(ArtifactAddressComponents VerifyEqual(firstLower, firstUpper); } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void CharacterChanged_ShouldNotBeEqual(ArtifactAddressComponentsTests.ValidCase @case) { string ModifyCharAt(string a, int index) - { + { char newChar = a[index] == 'q' ? 'z' : 'q'; return a.Substring(0, index) + newChar + a.Substring(index + 1); } for (int i = 0; i < @case.Value.Length - 1; ++i) - { + { OciArtifactReference first = Parse(@case.Value); var modified = ModifyCharAt(@case.Value, i); if (IsValid(modified)) - { + { OciArtifactReference second = Parse(modified); VerifyNotEqual(first, second); } } } - [DynamicData(nameof(GetValidCases), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] - [DataTestMethod] + [DynamicData(nameof(GetValidCases), DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] public void ValidReferenceShouldBeUriParseable(ArtifactAddressComponentsTests.ValidCase @case) { var parsed = Parse(@case.Value); @@ -152,7 +152,7 @@ public void ValidReferenceShouldBeUriParseable(ArtifactAddressComponentsTests.Va // valid digest plus 1 char [DataRow("example.com/hello/there@sha256:9aeb50c4b1a84de2315e2272c03bf940fa76c7c15e95dd6c5faabdb0945e6f8f1", "BCP224", "The specified OCI artifact reference \"br:example.com/hello/there@sha256:9aeb50c4b1a84de2315e2272c03bf940fa76c7c15e95dd6c5faabdb0945e6f8f1\" is not valid. The digest \"sha256:9aeb50c4b1a84de2315e2272c03bf940fa76c7c15e95dd6c5faabdb0945e6f8f1\" is not valid. The valid format is a string \"sha256:\" followed by exactly 64 lowercase hexadecimal digits.")] [DataRow("example.com/hello/there@sha256:9AEB50C4B1A84DE2315E2272C03BF940FA76C7C15E95DD6C5FAABDB0945E6F8F", "BCP224", "The specified OCI artifact reference \"br:example.com/hello/there@sha256:9AEB50C4B1A84DE2315E2272C03BF940FA76C7C15E95DD6C5FAABDB0945E6F8F\" is not valid. The digest \"sha256:9AEB50C4B1A84DE2315E2272C03BF940FA76C7C15E95DD6C5FAABDB0945E6F8F\" is not valid. The valid format is a string \"sha256:\" followed by exactly 64 lowercase hexadecimal digits.")] - [DataTestMethod] + [TestMethod] public void InvalidReferencesShouldProduceExpectedError(string value, string expectedCode, string expectedError) { TryParseOciArtifactReference(value).IsSuccess(out var @ref, out var failureBuilder).Should().BeFalse(); @@ -160,7 +160,7 @@ public void InvalidReferencesShouldProduceExpectedError(string value, string exp failureBuilder!.Should().NotBeNull(); using (new AssertionScope()) - { + { failureBuilder!.Should().HaveCode(expectedCode); failureBuilder!.Should().HaveMessage(expectedError); } @@ -168,7 +168,7 @@ public void InvalidReferencesShouldProduceExpectedError(string value, string exp [DataRow("TEST.azurecr.IO/foo/bar:latest", "test.azurecr.io/foo/bar:latest")] [DataRow("LOCALHOST:5000/test/ssss:v1", "localhost:5000/test/ssss:v1")] - [DataTestMethod] + [TestMethod] public void ReferencesWithRegistryCasingDifferencesShouldBeEqual(string package1, string package2) { var (first, second) = ParsePair(package1, package2); @@ -180,7 +180,7 @@ public void ReferencesWithRegistryCasingDifferencesShouldBeEqual(string package1 [DataRow("test.azurecr.io/foo/bar:latest", "test.azurecr.io/foo/bar:LATEST")] [DataRow("localhost:5000/test/ssss:version1", "localhost:5000/test/ssss:VERSION1")] [DataRow("one.azurecr.io/first/second:tag1", "two.azurecr.io/third/fourth:tag2")] - [DataTestMethod] + [TestMethod] public void MismatchedReferencesShouldNotBeEqual(string package1, string package2) { var (first, second) = ParsePair(package1, package2); @@ -188,7 +188,7 @@ public void MismatchedReferencesShouldNotBeEqual(string package1, string package first.GetHashCode().Should().NotBe(second.GetHashCode()); } - [DataTestMethod] + [TestMethod] [DataRow("")] [DataRow(" ")] [DataRow("****")] @@ -204,7 +204,7 @@ public void TryParse_InvalidAliasName_ReturnsFalseAndSetsErrorDiagnostic(string errorBuilder!.Should().HaveMessage($"The module alias name \"{aliasName}\" is invalid. Valid characters are alphanumeric, \"_\", or \"-\"."); } - [DataTestMethod] + [TestMethod] [DataRow("myRegistry", "path/to/module:v1", null, "BCP213", "The OCI artifact module alias name \"myRegistry\" does not exist in the built-in Bicep configuration.")] [DataRow("myModulePath", "myModule:v2", "/bicepconfig.json", "BCP213", "The OCI artifact module alias name \"myModulePath\" does not exist in the Bicep configuration \"/bicepconfig.json\".")] public void TryParse_AliasNotInConfiguration_ReturnsFalseAndSetsErrorDiagnostic(string aliasName, string referenceValue, string? configurationPath, string expectedCode, string expectedMessage) @@ -219,8 +219,8 @@ public void TryParse_AliasNotInConfiguration_ReturnsFalseAndSetsErrorDiagnostic( errorBuilder!.Should().HaveMessage(expectedMessage); } - [DataTestMethod] - [DynamicData(nameof(GetInvalidAliasData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetInvalidAliasData))] public void TryParse_InvalidAlias_ReturnsFalseAndSetsErrorDiagnostic(string aliasName, string referenceValue, IBicepConfiguration configuration, string expectedCode, string expectedMessage) { TryParseOciArtifactReference(referenceValue, aliasName, configuration).IsSuccess(out var reference, out var errorBuilder).Should().BeFalse(); @@ -231,8 +231,8 @@ public void TryParse_InvalidAlias_ReturnsFalseAndSetsErrorDiagnostic(string alia errorBuilder!.Should().HaveMessage(expectedMessage); } - [DataTestMethod] - [DynamicData(nameof(GetValidAliasData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetValidAliasData))] public void TryGetModuleReference_ValidAlias_ReplacesReferenceValue(string aliasName, string referenceValue, string fullyQualifiedReferenceValue, IBicepConfiguration configuration) { TryParseOciArtifactReference(referenceValue, aliasName, configuration).IsSuccess(out var reference, out var errorBuilder).Should().BeTrue(); @@ -273,7 +273,7 @@ private static IEnumerable GetInvalidAliasData() "myModule:v1", BicepTestConstants.CreateMockConfiguration( new() - { + { ["moduleAliases.br.myModulePath.modulePath"] = "path", }), "BCP216", @@ -286,7 +286,7 @@ private static IEnumerable GetInvalidAliasData() "myModule:v2", BicepTestConstants.CreateMockConfiguration( new() - { + { ["moduleAliases.br.myModulePath2.modulePath"] = "path2", }, "/bicepconfig.json"), @@ -303,7 +303,7 @@ private static IEnumerable GetValidAliasData() "mymodule:v1", "br:example.com/path/mymodule:v1", BicepTestConstants.CreateMockConfiguration(new() - { + { ["moduleAliases.br.myModulePath.registry"] = "example.com", ["moduleAliases.br.myModulePath.modulePath"] = "path", }), @@ -316,7 +316,7 @@ private static IEnumerable GetValidAliasData() "br:localhost:8000/root/parent/mymodule:v2", BicepTestConstants.CreateMockConfiguration( new() - { + { ["moduleAliases.br.myModulePath2.registry"] = "localhost:8000", ["moduleAliases.br.myModulePath2.modulePath"] = "root/parent", }, diff --git a/src/Bicep.Core.UnitTests/Modules/TemplateSpecModuleReferenceTests.cs b/src/Bicep.Core.UnitTests/Modules/TemplateSpecModuleReferenceTests.cs index d7c95b8479d..2936f966a09 100644 --- a/src/Bicep.Core.UnitTests/Modules/TemplateSpecModuleReferenceTests.cs +++ b/src/Bicep.Core.UnitTests/Modules/TemplateSpecModuleReferenceTests.cs @@ -19,30 +19,30 @@ public class TemplateSpecModuleReferenceTests { private static readonly BicepFile DummyReferencingFile = BicepTestConstants.SourceFileFactory.CreateBicepFile(DummyFileHandle.Default, ""); - [DataTestMethod] - [DynamicData(nameof(GetEqualData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetEqualData))] public void Equals_SameReferences_ReturnsTrue(TemplateSpecModuleReference first, TemplateSpecModuleReference second) => first.Equals(second).Should().BeTrue(); - [DataTestMethod] - [DynamicData(nameof(GetNotEqualData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetNotEqualData))] public void Equals_DifferentReferences_ReturnsFalse(TemplateSpecModuleReference first, TemplateSpecModuleReference second) => first.Equals(second).Should().BeFalse(); - [DataTestMethod] - [DynamicData(nameof(GetEqualData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetEqualData))] public void GetHashCode_SameReferences_ReturnsEqualHashCode(TemplateSpecModuleReference first, TemplateSpecModuleReference second) => first.GetHashCode().Should().Be(second.GetHashCode()); - [DataTestMethod] - [DynamicData(nameof(GetNotEqualData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetNotEqualData))] public void GetHashCode_DifferentReferences_ReturnsEqualHashCode(TemplateSpecModuleReference first, TemplateSpecModuleReference second) => first.GetHashCode().Should().NotBe(second.GetHashCode()); [DataRow("D9EEC7DB-8454-4EC1-8CD3-BB79D4CFEBEE/myRG/myTemplateSpec1:v123")] [DataRow("5AA8419E-AFEB-45F2-9078-ED2167AAF51C/test-rg/deploy:1.0.0")] [DataRow("D9EEC7DB-8454-4EC1-8CD3-BB79D4CFEBEE/myRG/myTemplateSpec1:v1")] - [DataTestMethod] + [TestMethod] public void TryParse_ValidReference_ReturnsParsedReference(string value) { var reference = Parse(value); @@ -61,7 +61,7 @@ public void TryParse_ValidReference_ReturnsParsedReference(string value) [DataRow("Test-RG/ts1:v1.")] [DataRow("Test-RG/.:v2")] [DataRow(":v100")] - [DataTestMethod] + [TestMethod] public void TryParse_InvalidReference_ReturnsFalseAndSetsFailureBuilder(string rawValue) { TemplateSpecModuleReference.TryParse(DummyReferencingFile.LoadFeatures(), DummyReferencingFile.LoadConfiguration(), null, rawValue).IsSuccess(out var parsed, out var failureBuilder).Should().BeFalse(); @@ -70,7 +70,7 @@ public void TryParse_InvalidReference_ReturnsFalseAndSetsFailureBuilder(string r failureBuilder!.Should().NotBeNull(); } - [DataTestMethod] + [TestMethod] [DataRow("prodRG", "mySpec:v1", null, "BCP212", "The Template Spec module alias name \"prodRG\" does not exist in the built-in Bicep configuration.")] [DataRow("testRG", "myModule:v2", "/bicepconfig.json", "BCP212", "The Template Spec module alias name \"testRG\" does not exist in the Bicep configuration \"/bicepconfig.json\".")] public void TryParse_AliasNotInConfiguration_ReturnsFalseAndSetsError(string aliasName, string referenceValue, string? configurationPath, string expectedCode, string expectedMessage) @@ -86,7 +86,7 @@ public void TryParse_AliasNotInConfiguration_ReturnsFalseAndSetsError(string ali errorBuilder!.Should().HaveMessage(expectedMessage); } - [DataTestMethod] + [TestMethod] [DataRow("")] [DataRow(" ")] [DataRow("****")] @@ -102,8 +102,8 @@ public void TryParse_InvalidAliasName_ReturnsFalseAndSetsErrorDiagnostic(string errorBuilder!.Should().HaveMessage($"The module alias name \"{aliasName}\" is invalid. Valid characters are alphanumeric, \"_\", or \"-\"."); } - [DataTestMethod] - [DynamicData(nameof(GetInvalidData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetInvalidData))] public void TryParse_InvalidAlias_ReturnsFalseAndSetsError(string aliasName, string referenceValue, IBicepConfiguration configuration, string expectedCode, string expectedMessage) { var bicepFile = CreateBicepFile(configuration); @@ -115,8 +115,8 @@ public void TryParse_InvalidAlias_ReturnsFalseAndSetsError(string aliasName, str errorBuilder!.Should().HaveMessage(expectedMessage); } - [DataTestMethod] - [DynamicData(nameof(GetValidData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetValidData))] public void TryGetModuleReference_ValidAlias_ReplacesReferenceValue(string aliasName, string referenceValue, string fullyQualifiedReferenceValue, IBicepConfiguration configuration) { var bicepFile = CreateBicepFile(configuration); @@ -175,7 +175,7 @@ private static IEnumerable GetInvalidData() "testRG", "mySpec:v1", BicepTestConstants.CreateMockConfiguration(new() - { + { ["moduleAliases.ts.testRG.resourceGroup"] = "production-resource-group", }), "BCP214", @@ -187,7 +187,7 @@ private static IEnumerable GetInvalidData() "prodRG", "mySpec:v1", BicepTestConstants.CreateMockConfiguration(new() - { + { ["moduleAliases.ts.prodRG.subscription"] = "1E7593D0-FCD1-4570-B132-51E4FD254967", }, "/bicepconfig.json"), @@ -204,7 +204,7 @@ private static IEnumerable GetValidData() "mySpec:v1", "ts:1E7593D0-FCD1-4570-B132-51E4FD254967/production-resource-group/mySpec:v1", BicepTestConstants.CreateMockConfiguration(new() - { + { ["moduleAliases.ts.prodRG.subscription"] = "1E7593D0-FCD1-4570-B132-51E4FD254967", ["moduleAliases.ts.prodRG.resourceGroup"] = "production-resource-group", }), @@ -216,7 +216,7 @@ private static IEnumerable GetValidData() "mySpec:v2", "ts:1E7593D0-FCD1-4570-B132-51E4FD254967/test-resource-group/mySpec:v2", BicepTestConstants.CreateMockConfiguration(new() - { + { ["moduleAliases.ts.testRG.subscription"] = "1E7593D0-FCD1-4570-B132-51E4FD254967", ["moduleAliases.ts.testRG.resourceGroup"] = "test-resource-group", }), diff --git a/src/Bicep.Core.UnitTests/Parsing/LexerTests.cs b/src/Bicep.Core.UnitTests/Parsing/LexerTests.cs index 330105d94f8..f162d0b794b 100644 --- a/src/Bicep.Core.UnitTests/Parsing/LexerTests.cs +++ b/src/Bicep.Core.UnitTests/Parsing/LexerTests.cs @@ -14,7 +14,7 @@ namespace Bicep.Core.UnitTests.Parsing [TestClass] public class LexerTests { - [DataTestMethod] + [TestMethod] [DataRow(@"''", "")] [DataRow(@"'test'", "test")] [DataRow(@"'hello there'", "hello there")] @@ -47,7 +47,7 @@ public void TryGetStringValue_WrongTokenType_ShouldReturnNull() Lexer.TryGetStringValue(token).Should().BeNull(); } - [DataTestMethod] + [TestMethod] [DataRow(@"")] [DataRow(@"hi")] [DataRow(@"'hello'there")] @@ -413,7 +413,7 @@ public void UnterminatedStringUnexpectedNewline_ShouldBeRecognizedWithError() [DataRow("ab")] [DataRow("a0")] [DataRow("resourceGroup")] - [DataTestMethod] + [TestMethod] public void ValidIdentifier_IsValidIdentifier_ShouldReturnTrue(string value) { Lexer.IsValidIdentifier(value).Should().BeTrue(); @@ -424,7 +424,7 @@ public void ValidIdentifier_IsValidIdentifier_ShouldReturnTrue(string value) [DataRow("2a")] [DataRow("a-b")] [DataRow("abz-b")] - [DataTestMethod] + [TestMethod] public void InvalidIdentifier_IsValidIdentifier_ShouldReturnFalse(string value) { Lexer.IsValidIdentifier(value).Should().BeFalse(); @@ -444,7 +444,7 @@ public void InvalidIdentifier_IsValidIdentifier_ShouldReturnFalse(string value) [DataRow(@"'\u{FfFf}'")] [DataRow(@"'\u{10000}'")] [DataRow(@"'\u{10FFFF}'")] - [DataTestMethod] + [TestMethod] public void CompleteStringsWithUnicodeEscapes_ShouldLexCorrectly(string text) { var diagnosticWriter = ToListDiagnosticWriter.Create(); @@ -462,7 +462,7 @@ public void CompleteStringsWithUnicodeEscapes_ShouldLexCorrectly(string text) [DataRow(@"'\u}'", @"\u")] [DataRow(@"'\u{110000}'", @"\u{110000}")] [DataRow(@"'\u{10Z'", @"\u{10")] - [DataTestMethod] + [TestMethod] public void InvalidUnicodeEscapes_ShouldProduceExpectedDiagnostic(string text, string expectedSpanText) { var diagnosticWriter = ToListDiagnosticWriter.Create(); @@ -499,7 +499,7 @@ public void InvalidUnicodeEscapes_ShouldProduceExpectedDiagnostic(string text, s [DataRow("''' \n \r \t \\ ' ${ } '''", " \n \r \t \\ ' ${ } ")] // leading and terminating ' characters [DataRow("''''a''''", "'a'")] - [DataTestMethod] + [TestMethod] public void Multiline_strings_should_lex_correctly(string text, string expectedValue) { var diagnosticWriter = ToListDiagnosticWriter.Create(); @@ -515,7 +515,7 @@ public void Multiline_strings_should_lex_correctly(string text, string expectedV [DataRow("'''abc")] [DataRow("'''abc''")] - [DataTestMethod] + [TestMethod] public void Unterminated_multiline_strings_should_attach_a_diagnostic(string text) { var diagnosticWriter = ToListDiagnosticWriter.Create(); diff --git a/src/Bicep.Core.UnitTests/Parsing/ParamsParserTests.cs b/src/Bicep.Core.UnitTests/Parsing/ParamsParserTests.cs index 4fea8e39f71..e7d58d2306c 100644 --- a/src/Bicep.Core.UnitTests/Parsing/ParamsParserTests.cs +++ b/src/Bicep.Core.UnitTests/Parsing/ParamsParserTests.cs @@ -11,7 +11,7 @@ namespace Bicep.Core.UnitTests.Parsing [TestClass] public class ParamsParserTests { - [DataTestMethod] + [TestMethod] [DataRow("true", "true", typeof(BooleanLiteralSyntax))] [DataRow("false", "false", typeof(BooleanLiteralSyntax))] [DataRow("432", "432", typeof(IntegerLiteralSyntax))] @@ -23,7 +23,7 @@ public void LiteralExpressionsShouldParseCorrectly(string text, string expected, RunExpressionTest(text, expected, expectedRootType); } - [DataTestMethod] + [TestMethod] [DataRow("param myint = 12 \n")] [DataRow("param mystr = 'hello world' \n")] public void TestParsingParameterAssignment(String text) @@ -33,7 +33,7 @@ public void TestParsingParameterAssignment(String text) programSyntax.Children.OfType().Should().HaveCount(1); } - [DataTestMethod] + [TestMethod] [DataRow("param myobj = {\nname : 'vm1'\nlocation : 'westus'\n} \n")] public void TestParameterObjectAssignment(String text) { @@ -42,7 +42,7 @@ public void TestParameterObjectAssignment(String text) programSyntax.Children.OfType().Should().HaveCount(1); } - [DataTestMethod] + [TestMethod] [DataRow("param myarr = [ 1\n2\n3\n4\n5 ] \n")] public void TestParameterArrayAssignment(String text) { @@ -51,7 +51,7 @@ public void TestParameterArrayAssignment(String text) programSyntax.Children.OfType().Should().HaveCount(1); } - [DataTestMethod] + [TestMethod] [DataRow("using './main.bicep' \n")] public void TestParsingUsingKeyword(String text) { diff --git a/src/Bicep.Core.UnitTests/Parsing/ParserTests.cs b/src/Bicep.Core.UnitTests/Parsing/ParserTests.cs index 833684e1439..df71e3648a7 100644 --- a/src/Bicep.Core.UnitTests/Parsing/ParserTests.cs +++ b/src/Bicep.Core.UnitTests/Parsing/ParserTests.cs @@ -11,7 +11,7 @@ namespace Bicep.Core.UnitTests.Parsing [TestClass] public class ParserTests { - [DataTestMethod] + [TestMethod] [DataRow("true", "true", typeof(BooleanLiteralSyntax))] [DataRow("false", "false", typeof(BooleanLiteralSyntax))] [DataRow("432", "432", typeof(IntegerLiteralSyntax))] @@ -23,7 +23,7 @@ public void LiteralExpressionsShouldParseCorrectly(string text, string expected, RunExpressionTest(text, expected, expectedRootType); } - [DataTestMethod] + [TestMethod] [DataRow("param myParam string", typeof(ParameterDeclarationSyntax))] [DataRow("var mvVar = 'hello'", typeof(VariableDeclarationSyntax))] [DataRow("resource myRes 'My.Provider/someResource@2020-08-01' = { \n }", typeof(ResourceDeclarationSyntax))] @@ -64,7 +64,7 @@ public void NewLinesForDeclarationsShouldBeOptionalAtEof(string text, Type expec } } - [DataTestMethod] + [TestMethod] [DataRow("'${abc}def'", "'${abc}def'")] [DataRow("'abc${def}'", "'abc${def}'")] [DataRow("'${abc}def${ghi}'", "'${abc}def${ghi}'")] @@ -78,7 +78,7 @@ public void StringInterpolationShouldParseCorrectly(string text, string expected RunExpressionTest(text, expected, typeof(StringSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("$'''${abc}def'''", "$'''${abc}def'''")] [DataRow("$'''abc${def}'''", "$'''abc${def}'''")] [DataRow("$'''${abc}def${ghi}'''", "$'''${abc}def${ghi}'''")] @@ -90,7 +90,7 @@ public void Multiline_string_interpolation_should_parse_correctly(string text, s RunExpressionTest(text, expected, typeof(StringSyntax)); } - [DataTestMethod] + [TestMethod] // empty [DataRow("''''''", "")] [DataRow("'''\r\n'''", "")] @@ -115,7 +115,7 @@ public void Multiline_strings_should_parse_correctly(string text, string expecte stringSyntax.TryGetLiteralValue().Should().Be(expectedValue); } - [DataTestMethod] + [TestMethod] [DataRow("'${>}def'")] [DataRow("'${concat)}def'")] [DataRow("'${'nest\\ed'}def'")] @@ -131,7 +131,7 @@ public void Interpolation_with_bad_expressions_should_parse_successfully(string expression.Expressions.Should().Contain(x => x is SkippedTriviaSyntax || x is BinaryOperationSyntax); } - [DataTestMethod] + [TestMethod] [DataRow("$'''${>}def'''")] [DataRow("$'''${concat)}def'''")] [DataRow("$'''${'nest\\ed'}def'''")] @@ -147,7 +147,7 @@ public void Multiline_interpolation_with_bad_expressions_should_parse_successful expression.Expressions.Should().Contain(x => x is SkippedTriviaSyntax || x is BinaryOperationSyntax); } - [DataTestMethod] + [TestMethod] [DataRow("'${!}def'")] [DataRow("'${ -}def'")] [DataRow("'${b+}def'")] @@ -162,7 +162,7 @@ public void Interpolation_with_incomplete_expressions_should_parse_successfully( expression.Expressions.Should().Contain(x => x is UnaryOperationSyntax || x is BinaryOperationSyntax || x is TernaryOperationSyntax); } - [DataTestMethod] + [TestMethod] [DataRow("$'''${!}def'''")] [DataRow("$'''${ -}def'''")] [DataRow("$'''${b+}def'''")] @@ -177,7 +177,7 @@ public void Multiline_interpolation_with_incomplete_expressions_should_parse_suc expression.Expressions.Should().Contain(x => x is UnaryOperationSyntax || x is BinaryOperationSyntax || x is TernaryOperationSyntax); } - [DataTestMethod] + [TestMethod] [DataRow("foo()", "foo()", 0)] [DataRow("bar(true)", "bar(true)", 1)] [DataRow("bar(true,1,'a',true,null)", "bar(true,1,'a',true,null)", 5)] @@ -188,7 +188,7 @@ public void FunctionsShouldParseCorrectly(string text, string expected, int expe expression.Arguments.Count().Should().Be(expectedArgumentCount); } - [DataTestMethod] + [TestMethod] [DataRow("foo", "foo")] [DataRow("bar", "bar")] public void VariablesShouldParseCorrectly(string text, string expected) @@ -196,7 +196,7 @@ public void VariablesShouldParseCorrectly(string text, string expected) RunExpressionTest(text, expected, typeof(VariableAccessSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("-10", "(-10)")] [DataRow("!x", "(!x)")] public void UnaryOperationsShouldParseCorrectly(string text, string expected) @@ -204,7 +204,7 @@ public void UnaryOperationsShouldParseCorrectly(string text, string expected) RunExpressionTest(text, expected, typeof(UnaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("!!true")] [DataRow("--10")] [DataRow("-!null")] @@ -214,7 +214,7 @@ public void UnaryOperatorsCannotBeChained(string text) expression.Expression.Should().BeOfType(); } - [DataTestMethod] + [TestMethod] [DataRow("2 + 3 * 4", "(2+(3*4))")] [DataRow("3 * 4 + 7", "((3*4)+7)")] [DataRow("2 + 3 * 4 - 10 % 2 - 1", "(((2+(3*4))-(10%2))-1)")] @@ -225,7 +225,7 @@ public void BinaryOperationsShouldHaveCorrectPrecedence(string text, string expe RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("2 + 3 + 4 -10", "(((2+3)+4)-10)")] [DataRow("2 * 3 / 5 % 100", "(((2*3)/5)%100)")] [DataRow("2 && 3 && 4 && 5", "(((2&&3)&&4)&&5)")] @@ -238,7 +238,7 @@ public void BinaryOperationsWithEqualPrecedenceShouldBeLeftToRightAssociative(st RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("2 + !null * 4", "(2+((!null)*4))")] [DataRow("-2 +-3 + -4 -10", "((((-2)+(-3))+(-4))-10)")] [DataRow("2 + 3 * !4 - 10 % 2 - -1", "(((2+(3*(!4)))-(10%2))-(-1))")] @@ -248,14 +248,14 @@ public void UnaryOperatorsShouldHavePrecedenceOverBinaryOperators(string text, s RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("null ? 4: false", "(null?4:false)")] public void TernaryOperatorShouldParseSuccessfully(string text, string expected) { RunExpressionTest(text, expected, typeof(TernaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("null && !false ? 2+3*-8 : !13 < 10", "((null&&(!false))?(2+(3*(-8))):((!13)<10))")] [DataRow("true == false != null == 4 != 'a' ? -2 && 3 && !4 && 5 : true || false && null", "(((((true==false)!=null)==4)!='a')?((((-2)&&3)&&(!4))&&5):(true||(false&&null)))")] [DataRow("null ? 1 : 2 + 3", "(null?1:(2+3))")] @@ -264,7 +264,7 @@ public void TernaryOperatorShouldHaveLowestPrecedence(string text, string expect RunExpressionTest(text, expected, typeof(TernaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("(true)", "(true)")] [DataRow("(false)", "(false)")] [DataRow("(null)", "(null)")] @@ -275,7 +275,7 @@ public void ParenthesizedExpressionShouldParseSuccessfully(string text, string e RunExpressionTest(text, expected, typeof(ParenthesizedExpressionSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("(2+3)*4", "(((2+3))*4)")] [DataRow("true && (false || null)", "(true&&((false||null)))")] [DataRow("(null ? 1 : 2) + 3", "(((null?1:2))+3)")] @@ -285,14 +285,14 @@ public void ParenthesizedExpressionsShouldHaveHighestPrecedence(string text, str RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("null ? 1 : 2 ? true ? 'a': 'b' : false ? 'd' : 15", "(null?1:(2?(true?'a':'b'):(false?'d':15)))")] public void TernaryOperatorShouldBeRightToLeftAssociative(string text, string expected) { RunExpressionTest(text, expected, typeof(TernaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a.b", "(a.b)")] [DataRow("null.fail", "(null.fail)")] [DataRow("foo().bar", "(foo().bar)")] @@ -302,7 +302,7 @@ public void PropertyAccessShouldParseSuccessfully(string text, string expected) RunExpressionTest(text, expected, typeof(PropertyAccessSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a::b", "(a::b)")] [DataRow("null::fail", "(null::fail)")] [DataRow("foo()::bar", "(foo()::bar)")] @@ -311,7 +311,7 @@ public void ResourceAccessShouldParseSuccessfully(string text, string expected) RunExpressionTest(text, expected, typeof(ResourceAccessSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("foo?bar:baz::biz", "(foo?bar:(baz::biz))")] [DataRow("foo?bar::biz.prop1:baz::boo", "(foo?((bar::biz).prop1):(baz::boo))")] [DataRow("foo::boo?bar:baz", "((foo::boo)?bar:baz)")] @@ -320,7 +320,7 @@ public void ResourceAccessShouldParseSuccessfullyWithTernaries(string text, stri RunExpressionTest(text, expected, typeof(TernaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a.b.c.foo()", "((a.b).c).foo()")] [DataRow("a.b.c.d.e.f.g.foo()", "((((((a.b).c).d).e).f).g).foo()")] [DataRow("a::b::c.d::e::f::g.foo()", "((((((a::b)::c).d)::e)::f)::g).foo()")] @@ -329,7 +329,7 @@ public void InstanceFunctionCallShouldParseSuccessfully(string text, string expe RunExpressionTest(text, expected, typeof(InstanceFunctionCallSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a.b.c + 0", "(((a.b).c)+0)")] [DataRow("(a.b[c]).c[d]+q()", "((((((a.b)[c])).c)[d])+q())")] public void MemberAccessShouldBeLeftToRightAssociative(string text, string expected) @@ -338,7 +338,7 @@ public void MemberAccessShouldBeLeftToRightAssociative(string text, string expec RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a::b::c + 0", "(((a::b)::c)+0)")] [DataRow("(a::b[c])::c[d]+q()", "((((((a::b)[c]))::c)[d])+q())")] public void ResourceAccessShouldBeLeftToRightAssociative(string text, string expected) @@ -347,21 +347,21 @@ public void ResourceAccessShouldBeLeftToRightAssociative(string text, string exp RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a + b.c * z[12].a && q[foo()] == c.a", "((a+((b.c)*((z[12]).a)))&&((q[foo()])==(c.a)))")] public void MemberAccessShouldHaveHighestPrecedence(string text, string expected) { RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a + b::c * z[12]::a && q[foo()] == c::a", "((a+((b::c)*((z[12])::a)))&&((q[foo()])==(c::a)))")] public void ResourceAccessShouldHaveHighestPrecedence(string text, string expected) { RunExpressionTest(text, expected, typeof(BinaryOperationSyntax)); } - [DataTestMethod] + [TestMethod] [DataRow("a[b]", "(a[b])")] [DataRow("1[b]", "(1[b])")] [DataRow("a[12]", "(a[12])")] @@ -373,7 +373,7 @@ public void ArrayAccessShouldParseSuccessfully(string text, string expected) RunExpressionTest(text, expected, typeof(ArrayAccessSyntax)); } - [DataTestMethod] + [TestMethod] // 3 alternative ways to produce the same character [DataRow(@"'𐐷'", @"'𐐷'", @"𐐷")] [DataRow(@"'\u{10437}'", @"'\u{10437}'", @"𐐷")] @@ -389,7 +389,7 @@ public void UnicodeEscapesShouldProduceExpectedCharacters(string text, string ex value.Should().Be(expectedLiteralValue); } - [DataTestMethod] + [TestMethod] [DataRow("a ?? b", "(a??b)")] [DataRow("a ?? b ?? c", "((a??b)??c)")] [DataRow("a ?? b || d ?? c", "((a??(b||d))??c)")] @@ -499,7 +499,7 @@ public void MultilineUnionTypeLiteralsShouldParseSuccessfully() } } - [DataTestMethod] + [TestMethod] [DataRow("input!", "(input!)", typeof(NonNullAssertionSyntax))] [DataRow("input.property!", "((input.property)!)", typeof(NonNullAssertionSyntax))] [DataRow("input.nested!.property", "(((input.nested)!).property)", typeof(PropertyAccessSyntax))] diff --git a/src/Bicep.Core.UnitTests/Parsing/TextSpanTests.cs b/src/Bicep.Core.UnitTests/Parsing/TextSpanTests.cs index 3eead847fdd..79eac17e591 100644 --- a/src/Bicep.Core.UnitTests/Parsing/TextSpanTests.cs +++ b/src/Bicep.Core.UnitTests/Parsing/TextSpanTests.cs @@ -28,7 +28,7 @@ public void NegativeLength_ShouldThrow() negativeLength.Should().Throw().WithMessage("Length must not be negative. (Parameter 'length')"); } - [DataTestMethod] + [TestMethod] [DataRow(1, 2, "[1:3]")] [DataRow(0, 0, "[0:0]")] [DataRow(10, 20, "[10:30]")] @@ -41,7 +41,7 @@ public void Constructor_ShouldPreserveLocation(int position, int length, string span.ToString().Should().Be(expectedRange); } - [DataTestMethod] + [TestMethod] [DataRow(10, 1, 20, 2, "[10:22]")] [DataRow(0, 0, 0, 0, "[0:0]")] [DataRow(70, 0, 60, 9, "[60:70]")] @@ -54,7 +54,7 @@ public void Between_ShouldCalculateCorrectRange(int firstPosition, int firstLeng TextSpan.Between(second, first).ToString().Should().Be(expectedBetweenRange); } - [DataTestMethod] + [TestMethod] [DataRow(10, 1, 20, 2, "[11:20]")] [DataRow(0, 0, 0, 0, "[0:0]")] [DataRow(70, 0, 60, 9, "[69:70]")] @@ -67,7 +67,7 @@ public void BetweenNonInclusive_ShouldCalculateCorrectRange(int firstPosition, i TextSpan.BetweenExclusive(second, first).ToString().Should().Be(expectedBetweenRange); } - [DataTestMethod] + [TestMethod] [DataRow("[0:0]", "[0:0]", false)] [DataRow("[0:1]", "[1:1]", false)] [DataRow("[0:1]", "[0:0]", false)] @@ -87,7 +87,7 @@ public void AreOverlapping_ShouldDetermineOverlapCorrectly(string firstSpan, str TextSpan.AreOverlapping(second, first).Should().Be(expectedOverlapResult); } - [DataTestMethod] + [TestMethod] [DataRow("[0:0]", "[0:0]", true)] [DataRow("[10:12]", "[12:13]", true)] [DataRow("[12:13]", "[10:12]", false)] @@ -101,7 +101,7 @@ public void AreNeighbors_ShouldProduceCorrectResult(string firstSpan, string sec TextSpan.AreNeighbors(first, second).Should().Be(expectedResult); } - [DataTestMethod] + [TestMethod] [DataRow("[0:0]", "[0:0]", "[0:0]")] [DataRow("[0:2]", "[2:3]", "[0:2]")] [DataRow("[2:3]", "[0:2]", "[2:3]")] @@ -116,7 +116,7 @@ public void BetweenInclusiveAndExclusive_ShouldProduceCorrectSpan(string inclusi TextSpan.BetweenInclusiveAndExclusive(inclusive, exclusive).ToString().Should().Be(expected); } - [DataTestMethod] + [TestMethod] [DataRow("[0:0]")] [DataRow("[0:1]")] [DataRow("[123:134]")] diff --git a/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2OptionsTests.cs b/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2OptionsTests.cs index 5f672288a3d..37571c5a411 100644 --- a/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2OptionsTests.cs +++ b/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2OptionsTests.cs @@ -10,7 +10,7 @@ namespace Bicep.Core.UnitTests.PrettyPrintV2 [TestClass] public class PrettyPrinterV2OptionsTests { - [DataTestMethod] + [TestMethod] [DataRow(-10, 0)] [DataRow(-1, 0)] [DataRow(20, 20)] @@ -27,7 +27,7 @@ public void Create_VariousIndentSizes_NormalizesSizes(int indentSize, int expect options.IndentSize.Should().Be(expectedIndentSize); } - [DataTestMethod] + [TestMethod] [DataRow(-10, 0)] [DataRow(-1, 0)] [DataRow(0, 0)] diff --git a/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2Tests.cs b/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2Tests.cs index 7b90e1c131f..e240863c796 100644 --- a/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2Tests.cs +++ b/src/Bicep.Core.UnitTests/PrettyPrintV2/PrettyPrinterV2Tests.cs @@ -31,7 +31,7 @@ public class PrettyPrinterV2Tests ] """.ReplaceLineEndings("\n"); - [DataTestMethod] + [TestMethod] [DataRow(IndentKind.Space, NewlineKind.CRLF, 2, true, "var foo = {\r\n prop1: true\r\n prop2: false\r\n prop3: {\r\n nestedProp1: 1\r\n nestedProp2: 2\r\n }\r\n}\r\n\r\nvar bar = [\r\n 1\r\n 2\r\n {\r\n prop1: true\r\n prop2: false\r\n }\r\n]\r\n")] [DataRow(IndentKind.Tab, NewlineKind.LF, 0, false, "var foo = {\n\tprop1: true\n\tprop2: false\n\tprop3: {\n\t\tnestedProp1: 1\n\t\tnestedProp2: 2\n\t}\n}\n\nvar bar = [\n\t1\n\t2\n\t{\n\t\tprop1: true\n\t\tprop2: false\n\t}\n]")] [DataRow(IndentKind.Tab, NewlineKind.CR, 2, true, "var foo = {\r\tprop1: true\r\tprop2: false\r\tprop3: {\r\t\tnestedProp1: 1\r\t\tnestedProp2: 2\r\t}\r}\r\rvar bar = [\r\t1\r\t2\r\t{\r\t\tprop1: true\r\t\tprop2: false\r\t}\r]\r")] diff --git a/src/Bicep.Core.UnitTests/Registry/ArtifactDispatcherTests.cs b/src/Bicep.Core.UnitTests/Registry/ArtifactDispatcherTests.cs index 00827e8f31c..5d433d9f974 100644 --- a/src/Bicep.Core.UnitTests/Registry/ArtifactDispatcherTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/ArtifactDispatcherTests.cs @@ -36,7 +36,7 @@ public void NoRegistries_ValidateModuleReference_ShouldReturnError() failureBuilder!.Should().NotBeNull(); using (new AssertionScope()) - { + { failureBuilder!.Should().HaveCode("BCP189"); failureBuilder!.Should().HaveMessage("Module references are not supported in this context."); } @@ -46,7 +46,7 @@ public void NoRegistries_ValidateModuleReference_ShouldReturnError() localModuleReference.Should().BeNull(); failureBuilder!.Should().NotBeNull(); using (new AssertionScope()) - { + { localModuleFailureBuilder!.Should().HaveCode("BCP189"); localModuleFailureBuilder!.Should().HaveMessage("Module references are not supported in this context."); } @@ -132,8 +132,8 @@ public async Task MockRegistries_ModuleLifecycle() goodAvailabilityBuilder3AfterRestore!.Should().HaveMessage("Failed to restore module"); } - [DataTestMethod] - [DynamicData(nameof(GetConfigurationData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetConfigurationData))] public async Task GetModuleRestoreStatus_ConfigurationChanges_ReturnsCachedStatusWhenChangeIsIrrelevant(IBicepConfiguration changedConfiguration, ArtifactRestoreStatus expectedStatus) { var badFile = BicepTestConstants.CreateDummyBicepFile(BicepTestConstants.CreateMockConfiguration()); @@ -171,7 +171,7 @@ private static IEnumerable GetConfigurationData() { // Irrelevant change. BicepTestConstants.CreateMockConfiguration(new() - { + { ["cloud.profiles.AzureCloud.resourceManagerEndpoint"] = "HTTPS://EXAMPLE.INVALID", ["cloud.profiles.AzureCloud.activeDirectoryAuthority"] = "https://example.invalid/", }), @@ -182,7 +182,7 @@ private static IEnumerable GetConfigurationData() { // Irrelevant change. BicepTestConstants.CreateMockConfiguration(new() - { + { ["cloud.currentProfile"] = "MyCloud", ["cloud.profiles.MyCloud.resourceManagerEndpoint"] = "HTTPS://EXAMPLE.INVALID", ["cloud.profiles.MyCloud.activeDirectoryAuthority"] = "https://example.invalid/", @@ -194,7 +194,7 @@ private static IEnumerable GetConfigurationData() { // Relevant change. BicepTestConstants.CreateMockConfiguration(new() - { + { ["cloud.currentProfile"] = "MyCloud", ["cloud.profiles.MyCloud.resourceManagerEndpoint"] = "https://example.invalid", ["cloud.profiles.MyCloud.activeDirectoryAuthority"] = "https://foo.bar.com", @@ -206,7 +206,7 @@ private static IEnumerable GetConfigurationData() { // Relevant change. BicepTestConstants.CreateMockConfiguration(new() - { + { ["cloud.credentialPrecedence"] = new[] { "VisualStudioCode" }, }), ArtifactRestoreStatus.Unknown @@ -225,7 +225,7 @@ private class MockModuleReference : ArtifactReference { public MockModuleReference(BicepSourceFile referencingFile, string reference) : base(referencingFile.LoadFeatures(), referencingFile.LoadConfiguration(), "mock") - { + { this.Reference = reference; } diff --git a/src/Bicep.Core.UnitTests/Registry/DescriptorFactoryTests.cs b/src/Bicep.Core.UnitTests/Registry/DescriptorFactoryTests.cs index 057c1c05616..25ae42345ac 100644 --- a/src/Bicep.Core.UnitTests/Registry/DescriptorFactoryTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/DescriptorFactoryTests.cs @@ -21,7 +21,7 @@ public void UnknownAlgorithmShouldThrow() [DataRow("sha256", "Hello there!", "sha256:89b8b8e486421463d7e0f5caf60fb9cb35ce169b76e657ab21fc4d1d6b093603")] [DataRow("sha512", "", "sha512:cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")] [DataRow("sha512", "Hello there!", "sha512:d0a1a241f4879b8fd8f9a2be55b004860f0e6f453ea8b42c8ad0e8cfc3721819dac6ec52f45b36044046b15cb8720874f701524aeac291921a865467781da456")] - [DataTestMethod] + [TestMethod] public void ShouldComputeCorrectDigest(string algorithmIdentifier, string content, string expectedDigest) { var actual = OciDescriptor.ComputeDigest(algorithmIdentifier, BinaryData.FromString(content)); diff --git a/src/Bicep.Core.UnitTests/Registry/OciModuleRegistryTests.cs b/src/Bicep.Core.UnitTests/Registry/OciModuleRegistryTests.cs index c58b9f98b3b..bb07451e544 100644 --- a/src/Bicep.Core.UnitTests/Registry/OciModuleRegistryTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/OciModuleRegistryTests.cs @@ -60,7 +60,7 @@ public void TryParseArtifactReference_ShouldSucceedForNonAzureRegistry() [DataRow("")] [DataRow(" ")] [DataRow(null)] - [DataTestMethod] + [TestMethod] public void GetDocumentationUri_WithInvalidManifestContents_ShouldReturnNull(string manifestFileContents) { (OciArtifactRegistry OciArtifactRegistry, OciArtifactReference OciArtifactReference) = CreateModuleRegistryWithCachedModuleReference( @@ -125,7 +125,7 @@ public void GetDocumentationUri_WithManifestFileAndNoAnnotations_ShouldReturnNul [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public void GetDocumentationUri_WithAnnotationsInManifestFileAndInvalidDocumentationUri_ShouldReturnNull(string documentationUri) { var manifestFileContents = @"{ @@ -328,7 +328,7 @@ public void GetDocumentationUri_WithMcrModuleReferenceAndNoDocumentationUriInMan [DataRow("")] [DataRow(" ")] [DataRow(null)] - [DataTestMethod] + [TestMethod] public void GetDescription_WithInvalidManifestContents_ShouldReturnNull(string manifestFileContents) { (OciArtifactRegistry OciArtifactRegistry, OciArtifactReference OciArtifactReference) = CreateModuleRegistryWithCachedModuleReference( @@ -466,7 +466,7 @@ public async Task GetDescription_WithValidDescriptionInManifestFile_ShouldReturn [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task GetDescription_WithAnnotationsInManifestFileAndInvalidDescription_ShouldReturnNull(string description) { var manifestFileContents = @"{ @@ -588,7 +588,7 @@ public async Task GetDescription_WithValidDescriptionAndDocumentationUriInManife } }"; - [DataTestMethod] + [TestMethod] [DataRow(false)] [DataRow(true)] public async Task PublishModuleWithSource_ShouldHaveSource(bool publishSource) @@ -615,7 +615,7 @@ public async Task PublishModuleWithSource_ShouldHaveSource(bool publishSource) } } - [DataTestMethod] + [TestMethod] // No sources at all [DataRow(jsonContentsV1, null, jsonContentsV2, null)] // Sources for only one version @@ -666,7 +666,7 @@ public async Task PublishArtifactWithSource_AtMultipleVersions_ShouldHaveRespect #region Pull modules - [DataTestMethod] + [TestMethod] [DataRow(false)] [DataRow(true)] public async Task RestoreModuleWithSource_ShouldRestoreSourceToDisk(bool publishSource) diff --git a/src/Bicep.Core.UnitTests/Registry/OciRegistryTransportFactoryTests.cs b/src/Bicep.Core.UnitTests/Registry/OciRegistryTransportFactoryTests.cs index d9e174af31a..1feece42c60 100644 --- a/src/Bicep.Core.UnitTests/Registry/OciRegistryTransportFactoryTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/OciRegistryTransportFactoryTests.cs @@ -16,7 +16,7 @@ namespace Bicep.Core.UnitTests.Registry; [TestClass] public class OciRegistryTransportFactoryTests { - [DataTestMethod] + [TestMethod] [DataRow("example.azurecr.io")] [DataRow("example.azurecr.cn")] [DataRow("example.azurecr.us")] @@ -26,7 +26,7 @@ public void IsAzureSdkHost_ReturnsTrue_ForKnownAzureHosts(string host) OciRegistryTransportFactory.IsAzureSdkHost(host).Should().BeTrue(); } - [DataTestMethod] + [TestMethod] [DataRow("ghcr.io")] [DataRow("localhost:5000")] [DataRow("docker.io")] diff --git a/src/Bicep.Core.UnitTests/Registry/TagEncoderTests.cs b/src/Bicep.Core.UnitTests/Registry/TagEncoderTests.cs index 18e6ec98b8b..a011b579ee3 100644 --- a/src/Bicep.Core.UnitTests/Registry/TagEncoderTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/TagEncoderTests.cs @@ -28,7 +28,7 @@ public class TagEncoderTests [DataRow("ABCDABCDABCDABCDABCDABCDABCDABCDA", "ABCDABCDABCDABCDABCDABCDABCDABCDA$1ffffffff")] [DataRow("ABCDABCDABCDABCDABCDABCDABCDABCDAbC", "ABCDABCDABCDABCDABCDABCDABCDABCDAbC$5ffffffff")] [DataRow(OciArtifactModuleReferenceTests.ExampleTagOfMaxLength, OciArtifactModuleReferenceTests.ExampleTagOfMaxLength + "$ffffff800000000000")] - [DataTestMethod] + [TestMethod] public void EncoderShouldProduceExpectedOutput(string tag, string expected) => TagEncoder.Encode(tag).Should().Be(expected); [TestMethod] diff --git a/src/Bicep.Core.UnitTests/Registry/TokenCredentialFactoryTests.cs b/src/Bicep.Core.UnitTests/Registry/TokenCredentialFactoryTests.cs index 78887ee46a3..80304377934 100644 --- a/src/Bicep.Core.UnitTests/Registry/TokenCredentialFactoryTests.cs +++ b/src/Bicep.Core.UnitTests/Registry/TokenCredentialFactoryTests.cs @@ -16,7 +16,7 @@ public class TokenCredentialFactoryTests { private static readonly Uri exampleAuthorityUri = new("https://bicep.test.invalid"); - [DataTestMethod] + [TestMethod] [DataRow(CredentialType.Environment, null, typeof(EnvironmentCredential))] [DataRow(CredentialType.ManagedIdentity, null, typeof(ManagedIdentityCredential))] [DataRow(CredentialType.VisualStudio, null, typeof(VisualStudioCredential))] @@ -29,8 +29,8 @@ public void ShouldCreateExpectedSingleCredential(CredentialType credentialType, f.CreateSingle(credentialType, credentialOptions, exampleAuthorityUri).Should().BeOfType(expectedCredentialType); } - [DataTestMethod] - [DynamicData(nameof(CreateManagedIdentityOptionsData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(CreateManagedIdentityOptionsData))] public void ShouldCreateExpectedSingleManagedIdentityCredential(CredentialOptions? credentialOptions) { var f = new TokenCredentialFactory(); diff --git a/src/Bicep.Core.UnitTests/Resource/ResourceTypeReferenceTests.cs b/src/Bicep.Core.UnitTests/Resource/ResourceTypeReferenceTests.cs index dc422c2d104..05af58ca8e4 100644 --- a/src/Bicep.Core.UnitTests/Resource/ResourceTypeReferenceTests.cs +++ b/src/Bicep.Core.UnitTests/Resource/ResourceTypeReferenceTests.cs @@ -9,7 +9,7 @@ namespace Bicep.Core.UnitTests.Resource [TestClass] public class ResourceTypeReferenceTests { - [DataTestMethod] + [TestMethod] [DataRow("")] [DataRow("+-")] [DataRow("-/abc")] @@ -23,7 +23,7 @@ public void InvalidType_ShouldBeRejected(string value) ResourceTypeReference.TryParse(value).Should().BeNull(); } - [DataTestMethod] + [TestMethod] [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "2019-06-01", "Microsoft.Compute", "virtualMachines")] [DataRow("Microsoft.Compute/virtualMachines/networkInterfaces@2019-06-01-alpha", "2019-06-01-alpha", "Microsoft.Compute", "virtualMachines", "networkInterfaces")] [DataRow("Microsoft.Blueprint/blueprints/versions/artifacts@2018-11-01-preview", "2018-11-01-preview", "Microsoft.Blueprint", "blueprints", "versions", "artifacts")] @@ -42,7 +42,7 @@ void AssertExpectations(ResourceTypeReference? typeRef) AssertExpectations(actual); } - [DataTestMethod] + [TestMethod] [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Compute/virtualMachines")] [DataRow("Microsoft.Blueprint/blueprints/versions/artifacts@2018-11-01-preview", "Microsoft.Blueprint/blueprints/versions/artifacts")] public void ValidType_FullyQualifiedTypeShouldBeCorrect(string value, string expectedFullyQualifiedType) @@ -53,7 +53,7 @@ public void ValidType_FullyQualifiedTypeShouldBeCorrect(string value, string exp actual!.FormatType().Should().Be(expectedFullyQualifiedType); } - [DataTestMethod] + [TestMethod] [DataRow("virtualMachines", "virtualMachines", (string?)null)] [DataRow("virtualMachines@2019-06-01", "virtualMachines", "2019-06-01")] [DataRow("artifacts@2018-11-01-preview", "artifacts", "2018-11-01-preview")] @@ -64,7 +64,7 @@ public void Parse_permits_types_with_single_type_segment_and_optional_version(st result.ApiVersion.Should().BeEquivalentTo(expectedVersion); } - [DataTestMethod] + [TestMethod] [DataRow("My.RP/someType@2020-01-01", "childType", "My.RP/someType/childType@2020-01-01")] [DataRow("My.RP/someType@2020-01-01", "childType/grandchildType", "My.RP/someType/childType/grandchildType@2020-01-01")] [DataRow("My.RP/someType@2020-01-01", "childType/grandchildType/greatGrandchildType", "My.RP/someType/childType/grandchildType/greatGrandchildType@2020-01-01")] @@ -79,7 +79,7 @@ public void Combine_CombinesValidTypeSegments(string baseTypeText, string childT actual.Should().NotBeNull(); actual!.FormatName().Should().BeEquivalentTo(expected); } - [DataTestMethod] + [TestMethod] [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Compute/virtualMachines@2019-06-01")] // same string [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Compute/vIrTuAlMaChiNeS@2019-06-01")] // different type casing [DataRow("Microsoft.Compute/virtualMachines@2019-06-01-preview", "Microsoft.Compute/vIrTuAlMaChiNeS@2019-06-01-PREVIEW")] // different api version casing @@ -94,7 +94,7 @@ public void Equals_and_GetHashCode_should_determine_equality_correctly_for_equal firstReference.GetHashCode().Should().Be(secondReference.GetHashCode(), $"calculated hash codes of '{firstReference}' and '{secondReference}' should be equal"); } - [DataTestMethod] + [TestMethod] [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Compute/virtualMachines@2019-07-01")] // different api version [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Compute/virtualMachineScaleSets@2019-06-01")] // different type [DataRow("Microsoft.Compute/virtualMachines@2019-06-01", "Microsoft.Copmute/virtualMachines@2019-06-01")] // different provider name diff --git a/src/Bicep.Core.UnitTests/Semantics/DescriptionHelperTests.cs b/src/Bicep.Core.UnitTests/Semantics/DescriptionHelperTests.cs index 75ff09a4959..932346ccf21 100644 --- a/src/Bicep.Core.UnitTests/Semantics/DescriptionHelperTests.cs +++ b/src/Bicep.Core.UnitTests/Semantics/DescriptionHelperTests.cs @@ -13,7 +13,7 @@ namespace Bicep.Core.UnitTests.Semantics; [TestClass] public class DescriptionHelperTests { - [DataTestMethod] + [TestMethod] [DataRow( @"{ ""$schema"": ""https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"", @@ -54,7 +54,7 @@ public void TryGetFromArmTemplate(string json, string? expectedDescription) description.Should().Be(expectedDescription); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ ""location"": ""westus2"", @@ -188,7 +188,7 @@ public void TryGetFromTemplateSpec(string json, string? expectedDescription) description.Should().Be(expectedDescription); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ ""$schema"": ""https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"", @@ -216,7 +216,7 @@ public void TryGetFromSemanticModel_ArmTemplate(string json, string? expectedDes DescriptionHelper.TryGetFromSemanticModel(model).Should().Be(expectedDescription); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ ""$schema"": ""https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"", diff --git a/src/Bicep.Core.UnitTests/Semantics/Namespaces/AzNamespaceTests.cs b/src/Bicep.Core.UnitTests/Semantics/Namespaces/AzNamespaceTests.cs index e9e5b0f7504..45b2969efe8 100644 --- a/src/Bicep.Core.UnitTests/Semantics/Namespaces/AzNamespaceTests.cs +++ b/src/Bicep.Core.UnitTests/Semantics/Namespaces/AzNamespaceTests.cs @@ -19,7 +19,7 @@ namespace Bicep.Core.UnitTests.Semantics.Namespaces [TestClass] public class AzNamespaceTests { - [DataTestMethod] + [TestMethod] [DataRow("toLogicalZone")] [DataRow("toLogicalZones")] [DataRow("toPhysicalZone")] diff --git a/src/Bicep.Core.UnitTests/Semantics/ObjectDeserializationTests.cs b/src/Bicep.Core.UnitTests/Semantics/ObjectDeserializationTests.cs index 035c8305595..76902a41820 100644 --- a/src/Bicep.Core.UnitTests/Semantics/ObjectDeserializationTests.cs +++ b/src/Bicep.Core.UnitTests/Semantics/ObjectDeserializationTests.cs @@ -99,19 +99,19 @@ private static void CompareSimpleJSON(string json) var correctList = new List { 1, 2 }; var correctObject = new Dictionary { { "nestedInt", 1 }, }; - Assert.AreEqual("someVal", jToken!["string"]); - Assert.AreEqual(123, jToken["int"]); + Assert.AreEqual("someVal", jToken!["string"]?.Value()); + Assert.AreEqual(123, jToken["int"]?.Value()); CollectionAssert.AreEqual(correctList, jToken["array"]?.ToObject>()); - Assert.AreEqual(1, jToken["array"]![0]); - Assert.AreEqual(2, jToken["array"]![1]); + Assert.AreEqual(1, jToken["array"]![0]?.Value()); + Assert.AreEqual(2, jToken["array"]![1]?.Value()); CollectionAssert.AreEqual(correctObject, jToken["object"]?["nestedObject"]?.ToObject>()); - Assert.AreEqual("someVal", jToken["object"]?["nestedString"]); + Assert.AreEqual("someVal", jToken["object"]?["nestedString"]?.Value()); - Assert.AreEqual(1, jToken["object"]?["nestedObject"]?["nestedInt"]); - Assert.AreEqual(1, jToken["object"]?["nestedArray"]![0]); - Assert.AreEqual(2, jToken["object"]?["nestedArray"]![1]); + Assert.AreEqual(1, jToken["object"]?["nestedObject"]?["nestedInt"]?.Value()); + Assert.AreEqual(1, jToken["object"]?["nestedArray"]![0]?.Value()); + Assert.AreEqual(2, jToken["object"]?["nestedArray"]![1]?.Value()); } [TestMethod] @@ -134,7 +134,7 @@ public void Unparsable_YAML() var span = new TextSpan(0, 10 - 0); new YamlObjectParser().TryExtractFromObject(invalidYml, null, [span]).IsSuccess(out _, out var errorDiagnostic); - Assert.AreEqual(errorDiagnostic!.Code, "BCP340"); + Assert.AreEqual("BCP340", errorDiagnostic!.Code); } [TestMethod] @@ -157,7 +157,7 @@ public void Unparsable_JSON() var span = new TextSpan(0, 10 - 0); new JsonObjectParser().TryExtractFromObject(invalidJson, null, [span]).IsSuccess(out _, out var errorDiagnostic); - Assert.AreEqual(errorDiagnostic!.Code, "BCP186"); + Assert.AreEqual("BCP186", errorDiagnostic!.Code); } [TestMethod] @@ -167,7 +167,7 @@ public void Complex_JSON_gets_deserialized_into_JSON() var arguments = new FunctionArgumentSyntax[4]; new YamlObjectParser().TryExtractFromObject(json, null, [arguments[0]]).IsSuccess(out var jToken); var expectedValue = "```bicep\ndateTimeFromEpoch([epochTime: int]): string\n\n```\nConverts an epoch time integer value to an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) dateTime string.\n"; - Assert.AreEqual(expectedValue, jToken!["documentation"]!["value"]); + Assert.AreEqual(expectedValue, jToken!["documentation"]!["value"]?.Value()); } @@ -190,10 +190,10 @@ public void Simple_YAML_file_content_gets_deserialized_into_JSON() var arguments = new FunctionArgumentSyntax[4]; new YamlObjectParser().TryExtractFromObject(yml, null, [arguments[0]]).IsSuccess(out var jToken); - Assert.AreEqual("George Washington", jToken!["name"]); - Assert.AreEqual("400", jToken["addresses"]!["home"]!["street"]!["house_number"]); - Assert.AreEqual(89, jToken["age"]); - Assert.AreEqual("Louaryland", jToken["addresses"]!["home"]!["city"]); + Assert.AreEqual("George Washington", jToken!["name"]?.Value()); + Assert.AreEqual("400", jToken["addresses"]!["home"]!["street"]!["house_number"]?.Value()); + Assert.AreEqual(89, jToken["age"]?.Value()); + Assert.AreEqual("Louaryland", jToken["addresses"]!["home"]!["city"]?.Value()); } [TestMethod] @@ -207,8 +207,8 @@ public void YAML_scalar_alias_gets_deserialized_into_JSON() var span = new TextSpan(0, 0); Assert.IsTrue(new YamlObjectParser().TryExtractFromObject(yml, null, [span]).IsSuccess(out var jToken)); - Assert.AreEqual("10.0.0.0/17", jToken!["source"]); - Assert.AreEqual("10.0.0.0/17", jToken["alias"]); + Assert.AreEqual("10.0.0.0/17", jToken!["source"]?.Value()); + Assert.AreEqual("10.0.0.0/17", jToken["alias"]?.Value()); } } diff --git a/src/Bicep.Core.UnitTests/SourceGraph/RelativePathTests.cs b/src/Bicep.Core.UnitTests/SourceGraph/RelativePathTests.cs index c5ea296a1ee..755fdcfbbd5 100644 --- a/src/Bicep.Core.UnitTests/SourceGraph/RelativePathTests.cs +++ b/src/Bicep.Core.UnitTests/SourceGraph/RelativePathTests.cs @@ -13,7 +13,7 @@ namespace Bicep.Core.UnitTests.SourceGraph [TestClass] public class RelativePathTests { - [DataTestMethod] + [TestMethod] [DataRow("C:\\Code\\file.txt")] [DataRow("d:/code/file.txt")] [DataRow("/home/code/file.txt")] @@ -26,7 +26,7 @@ public void Absolute_file_paths_fail(string filePath) error.Should().HaveMessage("The specified path seems to reference an absolute path. Files must be referenced using relative paths."); } - [DataTestMethod] + [TestMethod] [DataRow("code/file.txt")] public void Relative_file_paths_succeed(string filePath) { @@ -35,7 +35,7 @@ public void Relative_file_paths_succeed(string filePath) } - [DataTestMethod] + [TestMethod] [DataRow("code\\file.txt")] public void File_paths_with_backslash_fail(string filePath) { diff --git a/src/Bicep.Core.UnitTests/Syntax/SeparatedSyntaxListTests.cs b/src/Bicep.Core.UnitTests/Syntax/SeparatedSyntaxListTests.cs index 3d62ae59f9d..934769ec94d 100644 --- a/src/Bicep.Core.UnitTests/Syntax/SeparatedSyntaxListTests.cs +++ b/src/Bicep.Core.UnitTests/Syntax/SeparatedSyntaxListTests.cs @@ -23,7 +23,7 @@ public void EmptyListMustHaveZeroLengthSpan() [DataRow(1)] [DataRow(2)] [DataRow(100)] - [DataTestMethod] + [TestMethod] public void EmptyListMustHaveZeroSeparators(int separatorCount) { var separators = Enumerable.Repeat(TestSyntaxFactory.CreateToken(TokenType.Colon), separatorCount); @@ -37,7 +37,7 @@ public void EmptyListMustHaveZeroSeparators(int separatorCount) [DataRow(2, 0)] [DataRow(4, 1)] [DataRow(2, 3)] - [DataTestMethod] + [TestMethod] public void ListMustHaveOneFewerSeparatorThanElements(int elementCount, int separatorCount) { var elements = Enumerable.Repeat(TestSyntaxFactory.CreateInt(42), elementCount); diff --git a/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs b/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs index 79fa64537e6..b3ad87ad506 100644 --- a/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs +++ b/src/Bicep.Core.UnitTests/Syntax/SyntaxModifierTests.cs @@ -36,7 +36,7 @@ private static string RewriteProgram(string fileWithCursor, Func().WithMessage("*must not be a negative number*"); } - [DataTestMethod] - [DynamicData(nameof(GetTestDataForGetPosition), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTestDataForGetPosition))] public void GetPosition_ValidLineStartsAndOffset_ReturnsConvertedPosition(int[] lineStarts, int offset, (int line, int character) expectedPosition) { var position = TextCoordinateConverter.GetPosition(lineStarts, offset); position.Should().Be(expectedPosition); } - [DataTestMethod] - [DynamicData(nameof(GetTestDataForGetPosition), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTestDataForGetPosition))] public void GetOffset_ValidLineStartsAndOffset_ReturnsConvertedOffset(int[] lineStarts, int expectedOffset, (int line, int character) position) { var offset = TextCoordinateConverter.GetOffset(lineStarts, position.line, position.character); diff --git a/src/Bicep.Core.UnitTests/Text/TextPositionTests.cs b/src/Bicep.Core.UnitTests/Text/TextPositionTests.cs index 0bc738e74f6..92bb0b61bd2 100644 --- a/src/Bicep.Core.UnitTests/Text/TextPositionTests.cs +++ b/src/Bicep.Core.UnitTests/Text/TextPositionTests.cs @@ -12,7 +12,7 @@ namespace Bicep.Core.UnitTests.Text; [TestClass] public class TextPositionTests { - [DataTestMethod] + [TestMethod] [DataRow(-1, 0)] [DataRow(0, -1)] public void TextPosition_NegativeLineOrCharacter_Throws(int line, int character) @@ -20,7 +20,7 @@ public void TextPosition_NegativeLineOrCharacter_Throws(int line, int character) FluentActions.Invoking(() => new TextPosition(line, character)).Should().Throw(); } - [DataTestMethod] + [TestMethod] [DataRow(10, 0)] [DataRow(0, 10)] public void TextPosition_NonNegativeLineOrCharacter_DoesNotThrow(int line, int character) diff --git a/src/Bicep.Core.UnitTests/TypeSystem/Az/AzResourceTypeProviderTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/Az/AzResourceTypeProviderTests.cs index c59dd337788..0da6779d887 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/Az/AzResourceTypeProviderTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/Az/AzResourceTypeProviderTests.cs @@ -80,8 +80,8 @@ private static IEnumerable GetDeserializeTestData() public static string GetDeserializeTestDisplayName(MethodInfo info, object[] values) => $"{info.Name} ({string.Join(',', new[] { values[0], values[1], values[2] }.Select(x => x.ToString()))})"; - [DataTestMethod] - [DynamicData(nameof(GetDeserializeTestData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDeserializeTestDisplayName))] + [TestMethod] + [DynamicData(nameof(GetDeserializeTestData), DynamicDataDisplayName = nameof(GetDeserializeTestDisplayName))] public void AzResourceTypeProvider_can_deserialize_all_types_without_throwing(string providerName, string apiVersion, ResourceTypeGenerationFlags flags, IReadOnlyList resourceTypes) { // We deliberately load a new instance here for each test iteration rather than re-using an instance. diff --git a/src/Bicep.Core.UnitTests/TypeSystem/FunctionResolverTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/FunctionResolverTests.cs index ddabddf2e23..1c6cf42784c 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/FunctionResolverTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/FunctionResolverTests.cs @@ -29,8 +29,8 @@ public class FunctionResolverTests private static SemanticModel CreateDummySemanticModel() => TestCompiler.ForInMemoryCompilation().CompileWithoutRestore("").Compilation.GetEntrypointSemanticModel(); - [DataTestMethod] - [DynamicData(nameof(GetExactMatchData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetExactMatchData), DynamicDataDisplayName = nameof(GetDisplayName))] public void ExactOrPartialFunctionMatchShouldHaveCorrectReturnType(string displayName, string functionName, TypeSymbol expectedReturnType, IList argumentTypes) { var matches = GetMatches(functionName, argumentTypes, out _, out _); @@ -45,8 +45,8 @@ public void ExactOrPartialFunctionMatchShouldHaveCorrectReturnType(string displa matches.Single().ResultBuilder(CreateDummySemanticModel(), mockDiagnosticWriter.Object, functionCall, [.. argumentTypes]).Type.Should().Be(expectedReturnType); } - [DataTestMethod] - [DynamicData(nameof(GetAmbiguousMatchData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetAmbiguousMatchData), DynamicDataDisplayName = nameof(GetDisplayName))] public void FullyAmbiguousMatchesShouldHaveCorrectReturnType(string displayName, string functionName, int numberOfArguments, IList expectedReturnTypes) { var matches = GetMatches(functionName, Enumerable.Repeat(LanguageConstants.Any, numberOfArguments).ToList(), out _, out _); @@ -61,15 +61,15 @@ public void FullyAmbiguousMatchesShouldHaveCorrectReturnType(string displayName, matches.Select(m => m.ResultBuilder(CreateDummySemanticModel(), mockDiagnosticWriter.Object, functionCall, Enumerable.Repeat(LanguageConstants.Any, numberOfArguments).ToImmutableArray()).Type).Should().BeEquivalentTo(expectedReturnTypes); } - [DataTestMethod] - [DynamicData(nameof(GetMismatchData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetMismatchData), DynamicDataDisplayName = nameof(GetDisplayName))] public void MismatchShouldReturnAnEmptySet(string displayName, string functionName, IList argumentTypes) { GetMatches(functionName, argumentTypes, out _, out _).Should().BeEmpty(); } - [DataTestMethod] - [DynamicData(nameof(GetArgumentCountMismatchData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetArgumentCountMismatchData), DynamicDataDisplayName = nameof(GetDisplayName))] public void IncorrectArgumentCountShouldSetArgumentCountMismatches(string displayName, string functionName, Tuple argumentCountRange, IList argumentTypes) { GetMatches(functionName, argumentTypes, out List countMismatches, out List typeMismatches); @@ -85,8 +85,8 @@ public void IncorrectArgumentCountShouldSetArgumentCountMismatches(string displa } } - [DataTestMethod] - [DynamicData(nameof(GetArgumentTypeMismatchData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetArgumentTypeMismatchData), DynamicDataDisplayName = nameof(GetDisplayName))] public void IncorrectArgumentTypeShouldSetArgumentCountMismatches(string displayName, string functionName, List> parameterTypeAtIndexOverloads, IList argumentTypes) { GetMatches(functionName, argumentTypes, out List countMismatches, out List typeMismatches); @@ -118,15 +118,15 @@ public void LengthOfNonLiteralTuplesIsLiteral() evaluated.Type.Should().Be(TypeFactory.CreateIntegerLiteralType(3)); } - [DataTestMethod] - [DynamicData(nameof(GetLiteralTransformations), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetLiteralTransformations), DynamicDataDisplayName = nameof(GetDisplayName))] public void LiteralTransformationsYieldLiteralReturnType(string displayName, string functionName, IList argumentTypes, FunctionArgumentSyntax[] arguments, TypeSymbol expectedReturnType) { EvaluateFunction(functionName, argumentTypes, arguments).Type.Should().Be(expectedReturnType); } - [DataTestMethod] - [DynamicData(nameof(GetInputsThatFlattenToArrayOfAny), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetInputsThatFlattenToArrayOfAny))] public void ShouldFlattenToArrayOfAny(TypeSymbol typeToFlatten) { EvaluateFunction("flatten", new List { typeToFlatten }, [new FunctionArgumentSyntax(TestSyntaxFactory.CreateArray([]))]) @@ -134,30 +134,30 @@ public void ShouldFlattenToArrayOfAny(TypeSymbol typeToFlatten) .Item.Should().Be(LanguageConstants.Any); } - [DataTestMethod] - [DynamicData(nameof(GetFlattenPositiveTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetFlattenPositiveTestCases))] public void ShouldFlattenTo(TypeSymbol typeToFlatten, TypeSymbol expected) { TypeValidator.AreTypesAssignable(EvaluateFunction("flatten", new List { typeToFlatten }, [new FunctionArgumentSyntax(TestSyntaxFactory.CreateArray([]))]).Type, expected).Should().BeTrue(); } - [DataTestMethod] - [DynamicData(nameof(GetFlattenNegativeTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetFlattenNegativeTestCases))] public void ShouldNotFlatten(TypeSymbol typeToFlatten, params string[] diagnosticMessages) { EvaluateFunction("flatten", new List { typeToFlatten }, [new FunctionArgumentSyntax(TestSyntaxFactory.CreateArray([]))]).Type.GetDiagnostics().Cast() .Should().HaveDiagnostics(diagnosticMessages.Select(message => ("BCP309", DiagnosticLevel.Error, message))); } - [DataTestMethod] - [DynamicData(nameof(GetFirstTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetFirstTestCases))] public void FirstReturnsCorrectType(TypeSymbol inputArrayType, TypeSymbol expected) { TypeValidator.AreTypesAssignable(EvaluateFunction("first", new List { inputArrayType }, [new FunctionArgumentSyntax(TestSyntaxFactory.CreateArray([]))]).Type, expected).Should().BeTrue(); } - [DataTestMethod] - [DynamicData(nameof(GetLastTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetLastTestCases))] public void LastReturnsCorrectType(TypeSymbol inputArrayType, TypeSymbol expected) { TypeValidator.AreTypesAssignable(EvaluateFunction("last", new List { inputArrayType }, [new FunctionArgumentSyntax(TestSyntaxFactory.CreateArray([]))]).Type, expected).Should().BeTrue(); @@ -278,8 +278,8 @@ public void SplitReturnTypeIncludesNonZeroMinLength() returnedArray.MinLength.Should().Be(1); } - [DataTestMethod] - [DynamicData(nameof(GetPadLeftTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetPadLeftTestCases))] public void PadLeftReturnsCorrectType(IList argumentTypes, TypeSymbol expectedReturnType) { var returnType = EvaluateFunction("padLeft", argumentTypes, argumentTypes @@ -390,8 +390,8 @@ public void ParseUriFunction_ShouldReturnUriComponents() }); } - [DataTestMethod] - [DynamicData(nameof(GetLengthTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetLengthTestCases))] public void LengthInfersPossibleRangesFromRefinementMetadata(TypeSymbol argumentType, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("length", @@ -471,8 +471,8 @@ static object[] CreateRow(TypeSymbol argumentType, TypeSymbol returnType) }; } - [DataTestMethod] - [DynamicData(nameof(GetJoinTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetJoinTestCases))] public void JoinInfersPossibleLengthRangesFromRefinementMetadata(TypeSymbol typeToJoin, TypeSymbol delimiterType, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("join", @@ -511,8 +511,8 @@ static object[] CreateRow(TypeSymbol typeToJoin, TypeSymbol delimiterType, TypeS }; } - [DataTestMethod] - [DynamicData(nameof(GetSubstringTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetSubstringTestCases))] public void SubstringInfersPossibleLengthRangesFromRefinementMetadata(IList argumentTypes, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("substring", argumentTypes, argumentTypes @@ -548,8 +548,8 @@ static object[] CreateRow(TypeSymbol expectedReturnType, params TypeSymbol[] arg }; } - [DataTestMethod] - [DynamicData(nameof(GetSkipTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetSkipTestCases))] public void SkipInfersPossibleLengthRangesFromRefinementMetadata(TypeSymbol originalValue, TypeSymbol numberToSkip, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("skip", @@ -591,8 +591,8 @@ static object[] CreateRow(TypeSymbol originalValue, TypeSymbol numberToSkip, Typ }; } - [DataTestMethod] - [DynamicData(nameof(GetTakeTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTakeTestCases))] public void TakeInfersPossibleLengthRangesFromRefinementMetadata(TypeSymbol originalValue, TypeSymbol numberToTake, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("take", @@ -647,8 +647,8 @@ public void TrimDropsMinLengthButPreservesMaxLengthAndFlags() returnType.Should().Be(TypeFactory.CreateStringType(minLength: null, 20, validationFlags: TypeSymbolValidationFlags.IsSecure)); } - [DataTestMethod] - [DynamicData(nameof(GetRangeTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetRangeTestCases))] public void RangeInfersYieldRefinementsFromInputMetadata(TypeSymbol startIndex, TypeSymbol count, TypeSymbol expectedReturn) { var returnType = EvaluateFunction("range", diff --git a/src/Bicep.Core.UnitTests/TypeSystem/OperatorTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/OperatorTests.cs index e14a63a4db2..868c1a8d348 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/OperatorTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/OperatorTests.cs @@ -61,8 +61,8 @@ private static IEnumerable GetValues() where TEnum : struct public record DiagnosticMatcherData(DiagnosticLevel Level, string Code, string Message); - [DataTestMethod] - [DynamicData(nameof(GetUnaryTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetUnaryTestCases))] public void Unary_operator_resolves_correct_type(UnaryOperationSyntax expression, TypeSymbol operandType, TypeSymbol expected, IEnumerable expectedDiagnostics) { var diagnosticsWriter = ToListDiagnosticWriter.Create(); @@ -103,8 +103,8 @@ static object[] Case(UnaryOperationSyntax expression, TypeSymbol operandType, Ty }; } - [DataTestMethod] - [DynamicData(nameof(GetBinaryTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetBinaryTestCases))] public void Binary_operator_resolves_correct_type(BinaryOperator @operator, TypeSymbol leftOperandType, TypeSymbol rightOperandType, TypeSymbol expected, IEnumerable expectedDiagnostics) { var diagnosticsWriter = ToListDiagnosticWriter.Create(); diff --git a/src/Bicep.Core.UnitTests/TypeSystem/ResourceDerivedTypeResolverTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/ResourceDerivedTypeResolverTests.cs index 41b5915a7a5..b1764741d70 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/ResourceDerivedTypeResolverTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/ResourceDerivedTypeResolverTests.cs @@ -24,8 +24,8 @@ namespace Bicep.Core.UnitTests.TypeSystem; [TestClass] public class ResourceDerivedTypeResolverTests { - [DataTestMethod] - [DynamicData(nameof(GetTypesNotInNeedOfBinding), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTypesNotInNeedOfBinding))] public void Returns_input_if_no_unbound_types_are_enclosed(TypeSymbol type) { ResourceDerivedTypeResolver sut = new(StrictMock.Of().Object); diff --git a/src/Bicep.Core.UnitTests/TypeSystem/TypeHelperTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/TypeHelperTests.cs index 377009ba777..09a03c377f6 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/TypeHelperTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/TypeHelperTests.cs @@ -18,8 +18,8 @@ namespace Bicep.Core.UnitTests.TypeSystem; [TestClass] public class TypeHelperTests { - [DataTestMethod] - [DynamicData(nameof(GetPrimitiveCollapsePositiveTestCases), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetPrimitiveCollapsePositiveTestCases))] public void Primitive_collapse_preserves_and_fuses_refinements(TypeSymbol expected, params TypeSymbol[] toCollapse) { var actual = TypeHelper.TryCollapseTypes(toCollapse); diff --git a/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorAssignabilityTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorAssignabilityTests.cs index fc7d4132edd..bcae90cc5da 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorAssignabilityTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorAssignabilityTests.cs @@ -204,8 +204,8 @@ public void Generic_strings_can_be_assigned_to_string_literals_with_loose_assign TypeValidator.AreTypesAssignable(literalVal1, looseString).Should().BeTrue(); } - [DataTestMethod] - [DynamicData(nameof(GetStringDomainNarrowingData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetStringDomainNarrowingData))] public void String_domain_narrowing(TypeSymbol sourceType, TypeSymbol targetType, TypeSymbol expectedType, (string code, DiagnosticLevel level, string message)[] expectedDiagnostics) { Assert_domain_narrowing(sourceType, targetType, expectedType, expectedDiagnostics); @@ -330,8 +330,8 @@ public void IntegerLiteralTypesShouldBeAssignableToInts() TypeValidator.AreTypesAssignable(LanguageConstants.LooseInt, literalVal1).Should().BeTrue(); } - [DataTestMethod] - [DynamicData(nameof(GetIntegerDomainNarrowingData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetIntegerDomainNarrowingData))] public void Integer_domain_narrowing(TypeSymbol sourceType, TypeSymbol targetType, TypeSymbol expectedType, (string code, DiagnosticLevel level, string message)[] expectedDiagnostics) { Assert_domain_narrowing(sourceType, targetType, expectedType, expectedDiagnostics); @@ -398,8 +398,8 @@ static object[] Row(TypeSymbol sourceType, TypeSymbol targetType, TypeSymbol exp }; } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayName = nameof(GetDisplayName))] public void VariousObjects_ShouldProduceNoDiagnosticsWhenAssignedToObjectType(string displayName, ObjectSyntax @object) { var hierarchy = SyntaxHierarchy.Build(@object); @@ -409,8 +409,8 @@ public void VariousObjects_ShouldProduceNoDiagnosticsWhenAssignedToObjectType(st diagnostics.Should().BeEmpty(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayName = nameof(GetDisplayName))] public void Variousobjects_ShouldProduceAnErrorWhenAssignedToString(string displayName, ObjectSyntax @object) { var hierarchy = SyntaxHierarchy.Build(@object); @@ -504,8 +504,8 @@ public void InvalidTupleValuesShouldBeRejected() }); } - [DataTestMethod] - [DynamicData(nameof(GetArrayDomainNarrowingData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetArrayDomainNarrowingData))] public void Array_domain_narrowing(TypeSymbol sourceType, TypeSymbol targetType, TypeSymbol expectedReturnType, (string code, DiagnosticLevel level, string message)[] expectedDiagnostics) { var narrowedType = Assert_narrowing_diagnostics(sourceType, targetType, expectedDiagnostics); diff --git a/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorCompileTimeConstantTests.cs b/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorCompileTimeConstantTests.cs index ff3fdf5687a..52384aae12a 100644 --- a/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorCompileTimeConstantTests.cs +++ b/src/Bicep.Core.UnitTests/TypeSystem/TypeValidatorCompileTimeConstantTests.cs @@ -14,8 +14,8 @@ namespace Bicep.Core.UnitTests.TypeSystem [TestClass] public class TypeValidatorCompileTimeConstantTests { - [DataTestMethod] - [DynamicData(nameof(GetLiteralExpressionData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetLiteralExpressionData), DynamicDataDisplayName = nameof(GetDisplayName))] public void CompileTimeConstantExpressionShouldReturnNoViolations(string displayName, SyntaxBase expression) { var diagnosticWriter = ToListDiagnosticWriter.Create(); @@ -24,8 +24,8 @@ public void CompileTimeConstantExpressionShouldReturnNoViolations(string display diagnosticWriter.GetDiagnostics().Should().BeEmpty(); } - [DataTestMethod] - [DynamicData(nameof(GetNonLiteralExpressionData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetNonLiteralExpressionData), DynamicDataDisplayName = nameof(GetDisplayName))] public void NonLiteralExpression_IsLiteralExpression_ShouldReturnViolations(string displayName, SyntaxBase expression) { var diagnosticWriter = ToListDiagnosticWriter.Create(); @@ -34,8 +34,8 @@ public void NonLiteralExpression_IsLiteralExpression_ShouldReturnViolations(stri diagnosticWriter.GetDiagnostics().Should().NotBeEmpty(); } - [DataTestMethod] - [DynamicData(nameof(GetNonExpressionData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetNonExpressionData), DynamicDataDisplayName = nameof(GetDisplayName))] public void NonExpressionShouldProduceNoViolations(string displayName, SyntaxBase expression) { var diagnosticWriter = ToListDiagnosticWriter.Create(); diff --git a/src/Bicep.Decompiler.IntegrationTests/DecompilationTests.cs b/src/Bicep.Decompiler.IntegrationTests/DecompilationTests.cs index d0ae37bd905..4105d2aaf55 100644 --- a/src/Bicep.Decompiler.IntegrationTests/DecompilationTests.cs +++ b/src/Bicep.Decompiler.IntegrationTests/DecompilationTests.cs @@ -27,7 +27,7 @@ public class DecompilationTests private TestDecompiler CreateDecompilerWithEmptyAzResourceTypes() => new TestDecompiler().ConfigureServices(services => services.AddAzureResourceTypes([])); - [DataTestMethod] + [TestMethod] [EmbeddedFilesTestData(@"Files/Working/.*\.json")] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task Decompiler_generates_expected_bicep_files_with_diagnostics(EmbeddedFile embeddedJson) @@ -57,7 +57,7 @@ public async Task Decompiler_generates_expected_bicep_files_with_diagnostics(Emb } } - [DataTestMethod] + [TestMethod] [EmbeddedFilesTestData(@"Files/Parameters/.*\.json")] [TestCategory(BaselineHelper.BaselineTestCategory)] public void Decompiler_generates_expected_bicepparam_files_with_diagnostics(EmbeddedFile embeddedJson) @@ -80,7 +80,7 @@ private static string ReadResourceFile(string resourcePath) return new StreamReader(manifestStream).ReadToEnd(); } - [DataTestMethod] + [TestMethod] [DataRow("Files/NonWorking/unknownprops.json", "[15:29]: Unrecognized top-level resource property 'madeUpProperty'")] [DataRow("Files/NonWorking/invalid-schema.json", "[2:98]: $schema value \"https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#\" did not match any of the known ARM template deployment schemas.")] [DataRow("Files/NonWorking/keyvault-secret-reference.json", "[25:38]: Failed to convert parameter \"mySecret\": KeyVault secret references are not currently supported by the decompiler.")] @@ -98,7 +98,7 @@ public async Task Decompiler_raises_errors_for_unsupported_features(string resou await onDecompile.Should().ThrowAsync().WithMessage(expectedMessage); } - [DataTestMethod] + [TestMethod] [DataRow("\r\n", "\\r\\n")] [DataRow("\n", "\\n")] public async Task Decompiler_handles_strings_with_newlines(string newline, string escapedNewline) @@ -126,7 +126,7 @@ public async Task Decompiler_handles_strings_with_newlines(string newline, strin filesToSave[entryPointUri].Should().Contain($"var multilineString = 'multi{escapedNewline} line{escapedNewline} string'"); } - [DataTestMethod] + [TestMethod] [DataRow("and(variables('a'), variables('b'))", "boolean", "(a && b)")] [DataRow("and(variables('a'), variables('b'), variables('c'))", "boolean", "(a && b && c)")] [DataRow("or(variables('a'), variables('b'))", "boolean", "(a || b)")] diff --git a/src/Bicep.Decompiler.UnitTests/ArmHelpers/ExpressionHelpersTests.cs b/src/Bicep.Decompiler.UnitTests/ArmHelpers/ExpressionHelpersTests.cs index bcf606c39de..57aeb2882e0 100644 --- a/src/Bicep.Decompiler.UnitTests/ArmHelpers/ExpressionHelpersTests.cs +++ b/src/Bicep.Decompiler.UnitTests/ArmHelpers/ExpressionHelpersTests.cs @@ -23,7 +23,7 @@ public class ExpressionHelpersTests SingleStringHandling = ExpressionSerializerSingleStringHandling.SerializeAsString }); - [DataTestMethod] + [TestMethod] [DataRow("[concat('abc', concat('def'), 'ghi')]", "abcdefghi")] [DataRow("[format('{0}/{1}/{2}', 'abc', concat('def'), 'ghi')]", "abc/def/ghi")] [DataRow("[format('{2}/{0}/{1}', 'abc', concat('def'), 'ghi')]", "ghi/abc/def")] @@ -38,7 +38,7 @@ public void FlattenStringOperations_flattens_expressions_correctly(string input, output.Should().Be(expectedOutput); } - [DataTestMethod] + [TestMethod] [DataRow("[resourceId('Microsoft.Sql/servers', variables('dbServerName'))]", "Microsoft.Sql/servers", "[variables('dbServerName')]")] [DataRow("[resourceId('Microsoft.Sql/servers/databases', variables('dbServerName'), variables('dbName'))]", "Microsoft.Sql/servers/databases", "[concat(variables('dbServerName'), '/', variables('dbName'))]")] [DataRow("[concat('Microsoft.Sql/servers/', variables('dbServerName'), '/databases/', variables('dbName'))]", "Microsoft.Sql/servers/databases", "[concat(variables('dbServerName'), '/', variables('dbName'))]")] @@ -58,7 +58,7 @@ public void TryGetResourceNormalizedForm_returns_normalized_resource_expression( nameExpressionString.Should().Be(expectedNameExpression); } - [DataTestMethod] + [TestMethod] [DataRow("[concat('Microsoft.Network/networkSecurityGroups/', concat('nsg', variables('subnet0Name')))]")] [DataRow("[resourceId(parameters('vnetResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('vnetResourceName'))]")] [DataRow("[variables('hostingPlanName')]")] @@ -70,7 +70,7 @@ public void TryGetResourceNormalizedForm_fails_to_normalize_more_unusual_express normalizedForm.Should().BeNull(); } - [DataTestMethod] + [TestMethod] [DataRow("[uri('test.com', 'path/to/file.json')]", "path/to/file.json")] [DataRow("[uri('test.com', 'path/to/file.json', parameters('sasUri'))]", "path/to/file.json")] [DataRow("[concat(uri('test.com', 'path/to/file.json'), parameters('sasUri'))]", "path/to/file.json")] @@ -86,7 +86,7 @@ public void TryGetLocalFilePathForTemplateLink_finds_path_for_specific_expressio output.Should().Be(expectedOutput); } - [DataTestMethod] + [TestMethod] [DataRow("[parameters('location')]")] [DataRow("[variables('networkSettings').subnet.dse]")] public void TryGetLocalFilePathForTemplateLink_fails_to_find_path_for_undecidable_expression(string input) @@ -97,7 +97,7 @@ public void TryGetLocalFilePathForTemplateLink_fails_to_find_path_for_undecidabl output.Should().BeNull(); } - [DataTestMethod] + [TestMethod] [DataRow("{\"val\": \"[replaceMe()]\"}", "{\"val\": \"[replaced()]\"}")] [DataRow("{\"val\": [\"[replaceMe()]\"]}", "{\"val\": [\"[replaced()]\"]}")] [DataRow("{\"val\": [\"[nested(replaceMe())]\"]}", "{\"val\": [\"[nested(replaced())]\"]}")] @@ -119,7 +119,7 @@ public void RewriteExpressions_replaces_expressions(string jsonInput, string exp output.Should().DeepEqual(JToken.Parse(expectedJsonOutput)); } - [DataTestMethod] + [TestMethod] [DataRow("{\"val\": \"[visitMe()]\"}")] [DataRow("{\"val\": [\"[visitMe()]\"]}")] [DataRow("{\"val\": [\"[nested(visitMe())]\"]}")] diff --git a/src/Bicep.Decompiler.UnitTests/Naming/UniqueNamingResolverTests.cs b/src/Bicep.Decompiler.UnitTests/Naming/UniqueNamingResolverTests.cs index 39ebb5421a1..3dbab4318cf 100644 --- a/src/Bicep.Decompiler.UnitTests/Naming/UniqueNamingResolverTests.cs +++ b/src/Bicep.Decompiler.UnitTests/Naming/UniqueNamingResolverTests.cs @@ -10,7 +10,7 @@ namespace Bicep.Decompiler.UnitTests.Naming [TestClass] public class UniqueNamingResolverTests { - [DataTestMethod] + [TestMethod] [DataRow("testName", "test")] [DataRow("testRename", "testRename")] [DataRow("testName2", "test2")] diff --git a/src/Bicep.IO.UnitTests/Abstraction/FileSystemExceptionExtensionsTests.cs b/src/Bicep.IO.UnitTests/Abstraction/FileSystemExceptionExtensionsTests.cs index e21cc81aad6..d18d79051c3 100644 --- a/src/Bicep.IO.UnitTests/Abstraction/FileSystemExceptionExtensionsTests.cs +++ b/src/Bicep.IO.UnitTests/Abstraction/FileSystemExceptionExtensionsTests.cs @@ -10,7 +10,7 @@ namespace Bicep.IO.UnitTests.Abstraction; [TestClass] public class FileSystemExceptionExtensionsTests { - [DataTestMethod] + [TestMethod] [DataRow(typeof(IOException), true, true)] [DataRow(typeof(UnauthorizedAccessException), true, true)] [DataRow(typeof(ArgumentException), false, true)] diff --git a/src/Bicep.IO.UnitTests/Abstraction/IOUriExtensionsTests.cs b/src/Bicep.IO.UnitTests/Abstraction/IOUriExtensionsTests.cs index ceaf3b2f0d9..827c3cd0663 100644 --- a/src/Bicep.IO.UnitTests/Abstraction/IOUriExtensionsTests.cs +++ b/src/Bicep.IO.UnitTests/Abstraction/IOUriExtensionsTests.cs @@ -11,7 +11,7 @@ namespace Bicep.IO.UnitTests.Abstraction [TestClass] public class IOUriExtensionsTests { - [DataTestMethod] + [TestMethod] [DataRow("/a/b/c.txt", ".txt")] [DataRow("/a/b/c.tar.gz", ".gz")] [DataRow("/a/b/c", "")] @@ -29,7 +29,7 @@ public void GetExtension_ValidPaths_ReturnsCorrectExtension(string path, string extension.ToString().Should().Be(expectedExtension); } - [DataTestMethod] + [TestMethod] [DataRow("/a/b/c.txt", ".bak", "/a/b/c.bak")] [DataRow("/a/b/c.tar.gz", ".zip", "/a/b/c.tar.zip")] [DataRow("/a/b/c.tar.gz", "zip", "/a/b/c.tar.zip")] @@ -48,7 +48,7 @@ public void WithExtension_ValidPaths_ReturnsPathWithNewExtension(string path, st newResourceIdentifier.Path.Should().Be(expectedPath); } - [DataTestMethod] + [TestMethod] [DataRow("/a/b/c.txt", ".txt", true)] [DataRow("/a/b/c.txt", "txt", true)] [DataRow("/a/b/c.tar.gz", ".gz", true)] diff --git a/src/Bicep.IO.UnitTests/Abstraction/IOUriTests.cs b/src/Bicep.IO.UnitTests/Abstraction/IOUriTests.cs index 5d42535ea1d..07ba060913e 100644 --- a/src/Bicep.IO.UnitTests/Abstraction/IOUriTests.cs +++ b/src/Bicep.IO.UnitTests/Abstraction/IOUriTests.cs @@ -14,7 +14,7 @@ namespace Bicep.IO.UnitTests.Abstraction [TestClass] public class IOUriTests { - [DataTestMethod] + [TestMethod] [DataRow("http", "EXAMPLE.COM", "example.com")] [DataRow("http", "Example.Com", "example.com")] [DataRow("http", "example.com", "example.com")] @@ -33,7 +33,7 @@ public void IOUri_ByDefault_NormalizesAuthority(string scheme, string? authority resourceIdentifier.Authority.Should().Be(expectedAuthority); } - [DataTestMethod] + [TestMethod] [DataRow("/a/b/c", "/a/b/c")] [DataRow("/a/b/../c", "/a/c")] [DataRow("/a/./b/c", "/a/b/c")] @@ -49,7 +49,7 @@ public void IOUri_ByDefault_NormalizesNonFilePath(string inputPath, string expec resourceIdentifier.Path.Should().Be(expectedPath); } - [DataTestMethod] + [TestMethod] [DataRow("https", "")] [DataRow("https", null)] [DataRow("http", "")] @@ -61,7 +61,7 @@ public void IOUri_NullOrEmptyHttpOrHttpsAuthority_ThrowsArgumentException(string .Should().Throw(); } - [DataTestMethod] + [TestMethod] [DataRow("http", "example.com", "a/b/c")] [DataRow("http", null, "//a/b/c")] [DataRow("file", null, "a/b/c")] @@ -72,7 +72,7 @@ public void IOUri_InvalidPath_ThrowsArgumentException(string scheme, string? aut .Should().Throw(); } - [DataTestMethod] + [TestMethod] [DataRow("http", "example.com", "/a/b/c", "http://example.com/a/b/c")] [DataRow("https", "example.com", "/a/b/c", "https://example.com/a/b/c")] [DataRow("inmemory", null, "a/b/c", "inmemory:a/b/c")] @@ -136,7 +136,7 @@ public void GetHashCode_DifferentIdentifiers_ReturnsDifferentHashCodes() identifier1.GetHashCode().Should().NotBe(identifier2.GetHashCode()); } - [DataTestMethod] + [TestMethod] [DataRow("http", "example.com", "/a/b/c", "/a/b/", "c")] [DataRow("http", "example.com", "/a/b/c/", "/a/b/", "c/")] [DataRow("http", "example.com", "/a/b/c", "/a/b/c", "")] @@ -186,7 +186,7 @@ public void GetPathRelativeTo_DifferentAuthorities_ThrowsInvalidOperationExcepti act.Should().Throw(); } - [DataTestMethod] + [TestMethod] [DataRow("http", "example.com", "/a/b", "/a/b/c", true)] [DataRow("http", "example.com", "/a/b", "/a/b/c/d", true)] [DataRow("http", "example.com", "/a/b", "/a/b", true)] @@ -240,7 +240,7 @@ public void IsBaseOf_DifferentAuthorities_ReturnsFalse() result.Should().BeFalse(); } - [DataTestMethod] + [TestMethod] [DataRow("http", "example.com", "/a/b/c", "d/e", "http://example.com/a/b/d/e")] [DataRow("http", "example.com", "/a/b/c/", "d/e", "http://example.com/a/b/c/d/e")] [DataRow("http", "example.com", "/a/b/c", "../d/e", "http://example.com/a/d/e")] @@ -312,7 +312,7 @@ public void FromFilePath_WindowsAbsolutePath_ReturnsExpectedUri() uri.Path.Should().Be("/C:/a/b/c"); } - [DataTestMethod] + [TestMethod] [DataRow(@"\\server\share\file.txt", "server", "/share/file.txt")] [DataRow(@"\\myserver\documents\folder\file.bicep", "myserver", "/documents/folder/file.bicep")] [DataRow(@"\\SERVER\SHARE\file.txt", "server", "/SHARE/file.txt")] @@ -328,7 +328,7 @@ public void FromFilePath_UncPath_ReturnsExpectedUri(string uncPath, string expec uri.Path.Should().Be(expectedPath); } - [DataTestMethod] + [TestMethod] [DataRow(@"\\server\share\file.txt")] [DataRow(@"\\myserver\documents\folder\file.bicep")] [DataRow(@"\\file-server\public\docs\readme.md")] @@ -344,7 +344,7 @@ public void ToString_UncPath_ReturnsUncPath(string uncPath) result.Should().Be(uncPath); } - [DataTestMethod] + [TestMethod] [DataRow(@"\\server\share\file.txt", @"\\server\share\file.txt")] [DataRow(@"\\myserver\documents\folder\file.bicep", @"\\myserver\documents\folder\file.bicep")] [DataRow(@"\\file-server\public\docs\readme.md", @"\\file-server\public\docs\readme.md")] diff --git a/src/Bicep.LangServer.IntegrationTests/CodeActionTests.cs b/src/Bicep.LangServer.IntegrationTests/CodeActionTests.cs index af7e8118275..ae775549641 100644 --- a/src/Bicep.LangServer.IntegrationTests/CodeActionTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CodeActionTests.cs @@ -46,8 +46,8 @@ public partial class CodeActionTests : CodeActionTestBase private const string RemoveUnusedVariableTitle = "Remove unused variable"; private const string RemoveUnusedImportTitle = "Remove unused import"; - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task RequestingCodeActionWithFixableDiagnosticsShouldProduceQuickFixes(DataSet dataSet) { var (compilation, _, fileUri) = await dataSet.SetupPrerequisitesAndCreateCompilation(this.TestContext); @@ -362,7 +362,7 @@ public async Task VerifyCodeActionIsAvailableToSuppressCoreCompilerWarning() [DataRow("array", "@maxLength()", MaxLengthTitle)] [DataRow("int", "@minValue()", MinValueTitle)] [DataRow("int", "@maxValue()", MaxValueTitle)] - [DataTestMethod] + [TestMethod] public async Task Parameter_decorator_actions_are_suggested(string type, string decorator, string title) { (var codeActions, var bicepFile) = await RunParameterSyntaxTest(type); @@ -396,7 +396,7 @@ param foo {type} [DataRow("object", "@maxLength()", MaxLengthTitle)] [DataRow("int", "@minValue()", MinValueTitle)] [DataRow("int", "@maxValue()", MaxValueTitle)] - [DataTestMethod] + [TestMethod] public async Task Parameter_duplicate_decorators_are_not_suggested(string type, string decorator, string title) { (var codeActions, var bicepFile) = await RunParameterSyntaxTest(type, decorator); @@ -420,7 +420,7 @@ public async Task Parameter_duplicate_decorators_are_not_suggested(string type, [DataRow("bool", MaxValueTitle)] [DataRow("string", MaxValueTitle)] [DataRow("array", MaxValueTitle)] - [DataTestMethod] + [TestMethod] public async Task Parameter_decorators_are_not_suggested_for_unsupported_type(string type, string title) { (var codeActions, var bicepFile) = await RunParameterSyntaxTest(type); @@ -449,7 +449,7 @@ public async Task Parameter_decorators_are_not_suggested_for_unsupported_type(st name: 'app1' } ")] - [DataTestMethod] + [TestMethod] public async Task Unused_existing_resource_actions_are_suggested(string fileWithCursors, string expectedText) { (var codeActions, var bicepFile) = await GetCodeActionsForSyntaxTest(fileWithCursors, '|'); @@ -484,7 +484,7 @@ public async Task Unused_existing_resource_actions_are_suggested(string fileWith [DataRow(@"/* asdfds */var fo|o = 'asdf'", "")] [DataRow(@"/* asdf */var fo|o = 'asdf' var bar = 'asdf'", "var bar = 'asdf'")] - [DataTestMethod] + [TestMethod] public async Task Unused_variable_actions_are_suggested(string fileWithCursors, string expectedText) { (var codeActions, var bicepFile) = await GetCodeActionsForSyntaxTest(fileWithCursors, '|'); @@ -503,7 +503,7 @@ public async Task Unused_variable_actions_are_suggested(string fileWithCursors, [DataRow(@"@secure() param fo|o string param foo2 string", "param foo2 string")] - [DataTestMethod] + [TestMethod] public async Task Unused_parameter_actions_are_suggested(string fileWithCursors, string expectedText) { (var codeActions, var bicepFile) = await GetCodeActionsForSyntaxTest(fileWithCursors, '|'); @@ -596,7 +596,7 @@ func getString() string => 'exported' type t = string ", "import { } from '../mod.bicep'")] - [DataTestMethod] + [TestMethod] public async Task Unused_import_actions_are_suggested(string fileWithCursors, string importFileText, string expectedText) { var importFile = new LanguageClientFile("/mod.bicep", importFileText); @@ -631,7 +631,7 @@ public async Task Unused_import_actions_are_suggested(string fileWithCursors, st "import * as mod |")] [DataRow( "import * as mod from '|'")] - [DataTestMethod] + [TestMethod] public async Task Unused_import_actions_are_not_suggested_for_invalid_import(string fileWithCursors) { var importFile = new LanguageClientFile("/mod.bicep", """ @@ -657,7 +657,7 @@ public async Task Unused_import_actions_are_not_suggested_for_invalid_import(str [DataRow("var|")] [DataRow("var |")] - [DataTestMethod] + [TestMethod] public async Task Unused_variable_actions_are_not_suggested_for_invalid_variables(string fileWithCursors) { var (codeActions, _) = await GetCodeActionsForSyntaxTest(fileWithCursors, '|'); @@ -666,7 +666,7 @@ public async Task Unused_variable_actions_are_not_suggested_for_invalid_variable [DataRow("param|")] [DataRow("param |")] - [DataTestMethod] + [TestMethod] public async Task Unused_parameter_actions_are_not_suggested_for_invalid_parameters(string fileWithCursors) { var (codeActions, _) = await GetCodeActionsForSyntaxTest(fileWithCursors, '|'); diff --git a/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs b/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs index f065bf15cb1..85fe5b58aee 100644 --- a/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CodeLensTests.cs @@ -99,7 +99,7 @@ private SharedLanguageHelperManager CreateServer(string? bicepModuleEntrypointPa return defaultServer; } - [DataTestMethod] + [TestMethod] [DataRow($"file://{ROOT}path/to/localfile.bicep")] [DataRow($"file://{ROOT}path/to/localfile.json")] [DataRow($"file://{ROOT}path/to/localfile.bicepparam")] diff --git a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs index fc1cafacc38..e0a92af283f 100644 --- a/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/CompletionTests.cs @@ -137,8 +137,8 @@ public async Task EmptyFileShouldProduceDeclarationCompletions() actual.Should().EqualWithJsonDiffOutput(this.TestContext, expected, GetGlobalCompletionSetPath(expectedSetName), actualLocation); } - [DataTestMethod] - [DynamicData(nameof(GetSnippetCompletionData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetSnippetCompletionData), DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ValidateSnippetCompletionAfterPlaceholderReplacements(CompletionData completionData) { @@ -225,8 +225,8 @@ private async Task RequestSnippetCompletion(string bicepFileName, Comple return completion.TextEdit.TextEdit.NewText; } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayName = nameof(GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayName = nameof(GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task CompletionRequestShouldProduceExpectedCompletions(DataSet dataSet, string setName, IList positions) { @@ -2707,7 +2707,7 @@ public async Task List_functions_accepting_inputs_permit_object_key_completions( "); } - [DataTestMethod] + [TestMethod] [DataRow(@" resource abc 'Test.Rp/listFuncTests@2020-01-01' existing = { name: 'abc' @@ -3050,7 +3050,7 @@ func foo() string => | "); } - [DataTestMethod] + [TestMethod] [DataRow("func foo() | => 'blah'", "func foo() string| => 'blah'")] [DataRow("func foo() a| => 'blah'", "func foo() string| => 'blah'")] [DataRow("func foo() |a => 'blah'", "func foo() string| => 'blah'")] @@ -3072,7 +3072,7 @@ public async Task Func_lambda_output_type_completions_only_suggest_types(string """); } - [DataTestMethod] + [TestMethod] [DataRow("func foo(bar |) string => 'blah'", "func foo(bar string|) string => 'blah'")] [DataRow("func foo(bar a|) string => 'blah'", "func foo(bar string|) string => 'blah'")] [DataRow("func foo(bar |a) string => 'blah'", "func foo(bar string|) string => 'blah'")] @@ -3091,7 +3091,7 @@ public async Task Func_lambda_argument_type_completions_only_suggest_types(strin """); } - [DataTestMethod] + [TestMethod] [DataRow("func foo(|) string => 'blah'")] [DataRow("func foo( | ) string => 'blah'")] [DataRow("func foo(a|) string => 'blah'")] @@ -3870,7 +3870,7 @@ public async Task VerifyCompletionRequestResourceDependsOn_ResourceSymbolsVeryHi } } - [DataTestMethod] + [TestMethod] [DataRow("[(|)]")] [DataRow("[(|]")] [DataRow("[((|))]")] @@ -4232,7 +4232,7 @@ private enum ExpectedCompletionsScope DataSet } - [DataTestMethod] + [TestMethod] [DataRow("loadTextContent")] [DataRow("loadFileAsBase64")] [DataRow("loadJsonContent", true)] @@ -4366,7 +4366,7 @@ public async Task LoadFunctionsPathArgument_returnsFilesInCompletions(string fun } } - [DataTestMethod] + [TestMethod] [DataRow("loadTextContent")] [DataRow("loadFileAsBase64")] [DataRow("loadJsonContent", true)] @@ -4481,7 +4481,7 @@ public async Task LoadFunctionsPathArgument_returnsSymbolsAndFilePathsInCompleti } } - [DataTestMethod] + [TestMethod] [DataRow("module foo |", "../", "module foo '../|'")] [DataRow("module foo |", "other.bicep", "module foo 'other.bicep'|")] [DataRow("module foo .|", "../", "module foo '../|'")] @@ -4523,7 +4523,7 @@ public async Task Module_path_completions_are_offered(string fileWithCursors, st updatedFile.Should().HaveSourceText(expectedResult); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/|'", "groups.bicep", CompletionItemKind.File, "../", CompletionItemKind.Folder, "public", CompletionItemKind.Snippet)] [DataRow("module test 'br/|", "br/", CompletionItemKind.Folder, "../", CompletionItemKind.Folder, "public", CompletionItemKind.Snippet)] public async Task ModuleRegistryReferenceCompletions_GetCompletionsAfterBrSchema( @@ -4586,7 +4586,7 @@ public async Task ModuleRegistryReferenceCompletions_GetCompletionsForFolderInsi completions.Should().Contain(x => x.Label == "../" && x.Kind == CompletionItemKind.Folder); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/public:app/dapr-containerapp:|'", BicepSourceFileKind.BicepFile)] [DataRow("module test 'br/public:app/dapr-containerapp:|", BicepSourceFileKind.BicepFile)] [DataRow("module test 'br:mcr.microsoft.com/bicep/app/dapr-containerapp:|'", BicepSourceFileKind.BicepFile)] @@ -4640,7 +4640,7 @@ public async Task Public_module_version_completions(string inputWithCursors, Bic ); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/contoso:app/private-app:|'", BicepSourceFileKind.BicepFile)] [DataRow("module test 'br/contoso:app/private-app:|", BicepSourceFileKind.BicepFile)] [DataRow("module test 'br:private.contoso.com/app/private-app:|'", BicepSourceFileKind.BicepFile)] @@ -4906,7 +4906,7 @@ public async Task Public_registry_via_alias_supports_completions(string text, st ); } - [DataTestMethod] + [TestMethod] [DataRow("var arr1 = [|]")] [DataRow("param arr array = [|]")] [DataRow("var arr2 = [a, |]")] diff --git a/src/Bicep.LangServer.IntegrationTests/DefinitionHandlerTests.cs b/src/Bicep.LangServer.IntegrationTests/DefinitionHandlerTests.cs index 444b55589e5..ad71eb82561 100644 --- a/src/Bicep.LangServer.IntegrationTests/DefinitionHandlerTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/DefinitionHandlerTests.cs @@ -55,8 +55,8 @@ public static async Task ClassCleanup() await DefaultServer.DisposeAsync(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionRequestOnValidSymbolReferenceShouldReturnLocationOfDeclaredSymbol(DataSet dataSet) { var (compilation, _, fileUri) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -114,8 +114,8 @@ public async Task GoToDefinitionRequestOnValidSymbolReferenceShouldReturnLocatio } } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionRequestOnUnsupportedOrInvalidSyntaxNodeShouldReturnEmptyResponse(DataSet dataSet) { var uri = DocumentUri.From($"/{dataSet.Name}"); @@ -147,8 +147,8 @@ public async Task GoToDefinitionRequestOnUnsupportedOrInvalidSyntaxNodeShouldRet } } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionOnUnboundSyntaxNodeShouldReturnEmptyResponse(DataSet dataSet) { // local function @@ -223,7 +223,7 @@ await RunDefinitionScenarioTest(TestContext, text, '|', results => results.Shoul x => x.Should().BeEmpty())); } - [DataTestMethod] + [TestMethod] [DataRow("loadTextContent")] [DataRow("loadFileAsBase64")] [DataRow("loadJsonContent")] diff --git a/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs b/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs index 6f264fd529e..ded159111b4 100644 --- a/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/ExpressionAndTypeExtractorTests.cs @@ -43,7 +43,7 @@ public class ExpressionAndTypeExtractorTests : CodeActionTestBase //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ type superComplexType = { @@ -145,7 +145,7 @@ public async Task BicepDiscussion(string fileWithSelection, string expectedLoose //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ var a = '|b' @@ -318,7 +318,7 @@ public async Task Basics(string fileWithSelection, string? expectedVarText, stri """, null, null)] - [DataTestMethod] + [TestMethod] public async Task NullType(string fileWithSelection, string? expectedVarText, string? expectedLooseParamText, string? expectedMediumParamText, string? expectedResourceDerivedParamText) { await RunExtractToVariableAndParameterTest(fileWithSelection, expectedVarText, expectedLooseParamText, expectedMediumParamText, expectedResourceDerivedParamText); @@ -326,7 +326,7 @@ public async Task NullType(string fileWithSelection, string? expectedVarText, st //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ var a = '|b' @@ -359,7 +359,7 @@ public async Task ShouldOfferTwoParameterExtractions_IffTheExtractedTypesAreDiff //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ var newVariable = 'newVariable' @@ -468,7 +468,7 @@ public async Task ShouldRenameToAvoidConflicts(string fileWithSelection, string var v = { '99': _99 } """)] - [DataTestMethod] + [TestMethod] public async Task WeirdNames(string fileWithSelection, string expectedText) { await RunExtractToParameterTest(fileWithSelection, expectedText, "IGNORE", "IGNORE"); @@ -1077,7 +1077,7 @@ param p int? var v = newParameter """, null)] - [DataTestMethod] + [TestMethod] public async Task Params_InferType(string fileWithSelection, string expectedMediumParameterText, string expectedStrictParameterText, string? expectedResourceDerivedParameterText) { await RunExtractToParameterTest(fileWithSelection, expectedMediumParameterText, expectedStrictParameterText, expectedResourceDerivedParameterText); @@ -1145,7 +1145,7 @@ param _artifactsLocationSasToken string //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ resource vmName_resource 'Microsoft.Compute/virtualMachines@2019-12-01' = { @@ -1245,7 +1245,7 @@ public async Task ShouldPickUpPropertyName_ButOnlyIfFullPropertyValue(string fil //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( "var a = resourceGroup().locati|on", """ @@ -1490,7 +1490,7 @@ public async Task ShouldPickUpNameFromPropertyAccess_UpToTwoLevels(string fileWi // var blah1 = [newVariable, { foo: 'baz' }]", // """ // )] - [DataTestMethod] + [TestMethod] public async Task ShouldExpandSelectedExpressionsInALogicalWay_Expressions(string lineWithSelection, string expectedNewVarDeclaration) { await RunExtractToVariableTest(lineWithSelection, expectedNewVarDeclaration); @@ -1498,7 +1498,7 @@ public async Task ShouldExpandSelectedExpressionsInALogicalWay_Expressions(strin //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] // // Closest ancestor expression is the top-level expression itself -> offer to update full expression // @@ -1631,7 +1631,7 @@ await RunExtractToVarSingleLineTest( //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( "storageUri: reference(stora<>d, '2018-02-01').primaryEndpoints.blob", "var storageAccountId = storageAccount.id", @@ -1742,7 +1742,7 @@ await RunExtractToVarAndParamOnSingleLineTest( // name: '${storagePrefix}${newVariable}' // } // """)] - [DataTestMethod] + [TestMethod] public async Task IfThereIsASelection_ThenPickUpEverythingInTheSelection_AfterExpanding_StringExtrapolation(string fileWithSelection, string expectedVariableText) { await RunExtractToVariableTest(fileWithSelection, expectedVariableText); @@ -1750,7 +1750,7 @@ public async Task IfThereIsASelection_ThenPickUpEverythingInTheSelection_AfterEx //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ // My comment here @@ -1885,7 +1885,7 @@ public async Task Params_ShouldPickUpDescriptions(string fileWithSelection, stri //////////////////////////////////////////////////////////////////// - [DataTestMethod] + [TestMethod] [DataRow( """ var v = <<1>> @@ -2856,7 +2856,7 @@ await RunExtractToTypeTest( null); } - [DataTestMethod] + [TestMethod] [DataRow( """ resource nsg 'Microsoft.Network/networkSecurityGroups@2023-09-01' = { @@ -3245,7 +3245,7 @@ param p1 string ] """, 0)] - [DataTestMethod] + [TestMethod] public void TestGetFirstLineOfStatementIncludingComments(string bicep, int expected) { // Find the variable declaration line diff --git a/src/Bicep.LangServer.IntegrationTests/HoverTests.cs b/src/Bicep.LangServer.IntegrationTests/HoverTests.cs index 711b273e249..fe6ba6cb9fb 100644 --- a/src/Bicep.LangServer.IntegrationTests/HoverTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/HoverTests.cs @@ -58,8 +58,8 @@ public static async Task ClassCleanup() await ServerWithTestNamespaceProvider.DisposeAsync(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task HoveringOverSymbolReferencesAndDeclarationsShouldProduceHovers(DataSet dataSet) { var (compilation, _, fileUri) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -140,8 +140,8 @@ public async Task HoveringOverSymbolReferencesAndDeclarationsShouldProduceHovers } } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task HoveringOverNonHoverableElementsShouldProduceEmptyHovers(DataSet dataSet) { // local function @@ -454,7 +454,7 @@ param description string ); } - [DataTestMethod] + [TestMethod] [DataRow("json")] [DataRow("jsonc")] public async Task Hovers_are_displayed_on_description_metadata_in_json_module(string extension) @@ -731,7 +731,7 @@ public async Task PropertyHovers_are_displayed_on_partial_discriminator_objects( h => h!.Contents.MarkupContent!.Value.Should().Be("```bicep\nkind: 'BodyA' | 'BodyB'\n``` \n")); } - [DataTestMethod] + [TestMethod] // // DocumentationUri only, no description // diff --git a/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs b/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs index 82c40e320ae..c35a0964180 100644 --- a/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/ImportKubernetesManifestTests.cs @@ -21,7 +21,7 @@ public class ImportKubernetesManifestTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] + [TestMethod] [EmbeddedFilesTestData(@"Files/ImportKubernetesManifest/.*/.*\.yml")] [TestCategory(BaselineHelper.BaselineTestCategory)] public async Task ImportKubernetesManifest_generates_valid_bicep_files_from_kubernetes_manifests(EmbeddedFile embeddedYml) diff --git a/src/Bicep.LangServer.IntegrationTests/ParamsCompletionTests.cs b/src/Bicep.LangServer.IntegrationTests/ParamsCompletionTests.cs index ecff282cbe8..cf0a371b49c 100644 --- a/src/Bicep.LangServer.IntegrationTests/ParamsCompletionTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/ParamsCompletionTests.cs @@ -23,7 +23,7 @@ public class ParamsCompletionTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] + [TestMethod] [DataRow( @" //Parameters file @@ -162,7 +162,7 @@ public async Task Request_for_parameter_identifier_completions_should_return_cor 'two' ]) param firstParam string", new[] { "'one'", "'two'" }, new[] { CompletionItemKind.EnumMember, CompletionItemKind.EnumMember })] - [DataTestMethod] + [TestMethod] public async Task Value_completions_should_be_based_on_type(string paramTextWithCursor, string bicepText, string[] expectedLabels, CompletionItemKind[] expectedKinds) { var fileTextsByUri = new Dictionary @@ -341,7 +341,7 @@ public async Task Request_for_using_declaration_path_completions_should_return_c |")] [DataRow(@"param foo = 23 |")] - [DataTestMethod] + [TestMethod] public async Task Param_file_should_have_keyword_completions(string text) { var completions = await RunCompletionScenario(text, [], '|'); @@ -384,7 +384,7 @@ public async Task Param_file_should_have_keyword_completions(string text) [DataRow(@"using 'foo.bicep' using 'bar.bicep' |")] - [DataTestMethod] + [TestMethod] public async Task Using_completion_should_only_be_offered_once(string paramTextWithCursor) { var completions = await RunCompletionScenario(paramTextWithCursor, [], '|'); diff --git a/src/Bicep.LangServer.IntegrationTests/SemanticTokenTests.cs b/src/Bicep.LangServer.IntegrationTests/SemanticTokenTests.cs index 092848fdf2c..62d416d2c8b 100644 --- a/src/Bicep.LangServer.IntegrationTests/SemanticTokenTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/SemanticTokenTests.cs @@ -43,8 +43,8 @@ public static async Task ClassCleanup() await DefaultServer.DisposeAsync(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task Overlapping_tokens_are_not_returned(DataSet dataSet) { var uri = DocumentUri.From($"{dataSet.Name}"); @@ -77,8 +77,8 @@ public async Task Overlapping_tokens_are_not_returned(DataSet dataSet) } } - [DataTestMethod] - [DynamicData(nameof(GetParamsData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetParamsData))] public async Task Correct_semantic_tokens_are_returned_for_params_file(string paramFileText, TextSpan[] spans, SemanticTokenType[] tokenType) { var baseFilePath = $"file:///{TestContext.TestName}_{Guid.NewGuid():D}"; diff --git a/src/Bicep.LangServer.IntegrationTests/SignatureHelpTests.cs b/src/Bicep.LangServer.IntegrationTests/SignatureHelpTests.cs index 3f396fb3e25..d9166fb8b4e 100644 --- a/src/Bicep.LangServer.IntegrationTests/SignatureHelpTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/SignatureHelpTests.cs @@ -46,8 +46,8 @@ public static async Task ClassCleanup() await DefaultServer.DisposeAsync(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task ShouldProvideSignatureHelpBetweenFunctionParentheses(DataSet dataSet) { var (compilation, _, fileUri) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); @@ -101,8 +101,8 @@ public async Task NonExistentUriShouldProvideNoSignatureHelp() signatureHelp.Should().BeNull(); } - [DataTestMethod] - [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task NonFunctionCallSyntaxShouldProvideNoSignatureHelp(DataSet dataSet) { var (compilation, _, fileUri) = await dataSet.SetupPrerequisitesAndCreateCompilation(TestContext); diff --git a/src/Bicep.LangServer.IntegrationTests/SnippetTemplatesTests.cs b/src/Bicep.LangServer.IntegrationTests/SnippetTemplatesTests.cs index 86ad3139bcc..c6c26fd7dc3 100644 --- a/src/Bicep.LangServer.IntegrationTests/SnippetTemplatesTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/SnippetTemplatesTests.cs @@ -23,8 +23,8 @@ public class SnippetTemplatesTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] - [DynamicData(nameof(GetSnippetCompletionData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetSnippetCompletionData), DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void VerifySnippetTemplatesAreErrorFree(CompletionData completionData) { @@ -63,12 +63,12 @@ public void VerifySnippetTemplatesAreErrorFree(CompletionData completionData) { var errors = semanticModel.GetAllDiagnostics().Where(x => x.IsError()); var sourceTextWithDiags = OutputHelper.AddDiagsToSourceText(bicepContents, "\n", errors, diag => OutputHelper.GetDiagLoggingString(bicepContents, outputDirectory, diag)); - Assert.Fail("Template with prefix {0} contains errors. Please fix following errors:\n {1}", completionData.Prefix, sourceTextWithDiags); + Assert.Fail($"Template with prefix {completionData.Prefix} contains errors. Please fix following errors:\n {sourceTextWithDiags}"); } } - [DataTestMethod] - [DynamicData(nameof(GetSnippetCompletionData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetSnippetCompletionData), DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] [TestCategory(BaselineHelper.BaselineTestCategory)] public void VerifySnippetTemplatesDoNotContainTargetScope(CompletionData completionData) { @@ -78,12 +78,12 @@ public void VerifySnippetTemplatesDoNotContainTargetScope(CompletionData complet if (children.Any(x => x is TargetScopeSyntax targetScopeSyntax && targetScopeSyntax is not null)) { - Assert.Fail("Snippet templates should not contain targetScope. Please remove targetScope from template with prefix {0}.", completionData.Prefix); + Assert.Fail($"Snippet templates should not contain targetScope. Please remove targetScope from template with prefix {completionData.Prefix}."); } } - [DataTestMethod] - [DynamicData(nameof(GetSnippetCompletionData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetSnippetCompletionData), DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] public void VerifySnippetTemplatesDoNotContainResourceGroupLocation(CompletionData completionData) { if ( @@ -91,12 +91,12 @@ public void VerifySnippetTemplatesDoNotContainResourceGroupLocation(CompletionDa || completionData.SnippetText.Contains("deployment().location") ) { - Assert.Fail("Snippet templates should not contain resourceGroup().location or deployment().location. Snippet: {0}.", completionData.Prefix); + Assert.Fail($"Snippet templates should not contain resourceGroup().location or deployment().location. Snippet: {completionData.Prefix}."); } } - [DataTestMethod] - [DynamicData(nameof(GetSnippetCompletionData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] + [TestMethod] + [DynamicData(nameof(GetSnippetCompletionData), DynamicDataDisplayNameDeclaringType = typeof(CompletionData), DynamicDataDisplayName = nameof(CompletionData.GetDisplayName))] public void VerifySnippetTemplatesUseCorrectLocationSyntax(CompletionData completionData) { if (completionData.SnippetText.Contains("location:") && !completionData.SnippetText.Contains("location: 'global'")) // location: 'global' is okay diff --git a/src/Bicep.LangServer.IntegrationTests/TextDocumentSyncTests.cs b/src/Bicep.LangServer.IntegrationTests/TextDocumentSyncTests.cs index dc241ff0332..51472bdab14 100644 --- a/src/Bicep.LangServer.IntegrationTests/TextDocumentSyncTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/TextDocumentSyncTests.cs @@ -24,7 +24,7 @@ public class TextDocumentSyncTests [NotNull] public TestContext? TestContext { get; set; } - [DataTestMethod] + [TestMethod] [DataRow("/template.bicep")] [DataRow("untitled:Untitled-1")] public async Task DidOpenTextDocument_should_trigger_PublishDiagnostics(string uri) diff --git a/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs b/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs index 0d2426203f6..61c0148fc68 100644 --- a/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs +++ b/src/Bicep.LangServer.IntegrationTests/TypeStringifierTests.cs @@ -36,7 +36,7 @@ public class TypeStringifierTests { private static bool debugPrintAllSyntaxNodeTypes = false; - [DataTestMethod] + [TestMethod] [DataRow( "type testType = int", "type loose = int", @@ -62,7 +62,7 @@ public void SimpleTypes(string typeDeclaration, string expectedLooseSyntax, stri RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = 123", "type loose = int", @@ -83,7 +83,7 @@ public void LiteralTypes(string typeDeclaration, string expectedLooseSyntax, str RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = 123|234", "type loose = int", @@ -119,13 +119,13 @@ public void DontWidenLiteralTypesWithMediumWhenPartOfAUnion(string typeDeclarati // TODO: better would be: "type medium = ('fizz' | 42 | {an: 'object'} | null)[]", "type medium = ((object /* 'fizz' | 42 | { an: 'object' } */)?)[]", "type strict = ((object /* 'fizz' | 42 | { an: 'object' } */)?)[]")] - [DataTestMethod] + [TestMethod] public void MixedTypeArrays(string typeDeclaration, string expectedLooseSyntax, string expectedMediumStrictSyntax, string expectedStrictSyntax) { RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = object", "type loose = object", @@ -161,7 +161,7 @@ public void ObjectTypes(string typeDeclaration, string expectedLooseSyntax, stri RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = 'abc' | 'def' | 'ghi'", "type loose = string", @@ -192,7 +192,7 @@ public void UnionTypes(string typeDeclaration, string expectedLooseSyntax, strin RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = [1, 2, 3]", "type loose = array", @@ -329,13 +329,13 @@ public void TupleTypes(string typeDeclaration, string expectedLooseSyntax, strin "type loose = (object /* 'abc' | [string] | int | string */)?", "type medium = (object /* 'abc' | [string] | int | string */)?", "type strict = (object /* 'abc' | [string] | int | string */)?")] - [DataTestMethod] + [TestMethod] public void OpenEnumTypes(string typeDeclaration, string expectedLooseSyntax, string expectedMediumStrictSyntax, string expectedStrictSyntax) { RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = string[]", "type loose = array", @@ -361,7 +361,7 @@ public void TypedArrays(string typeDeclaration, string expectedLooseSyntax, stri RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = array", "type loose = array", @@ -372,7 +372,7 @@ public void ArrayType(string typeDeclaration, string expectedLooseSyntax, string RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = []", "type loose = array", @@ -384,7 +384,7 @@ public void EmptyArray(string typeDeclaration, string expectedLooseSyntax, strin RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = {}", "type loose = object", @@ -395,7 +395,7 @@ public void EmptyObject(string typeDeclaration, string expectedLooseSyntax, stri RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = []", "type loose = array", @@ -407,7 +407,7 @@ public void EmptyArrays(string typeDeclaration, string expectedLooseSyntax, stri RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = [testType?]", "type loose = array", @@ -433,7 +433,7 @@ public void RecursiveTypes(string typeDeclaration, string expectedLooseSyntax, s RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] [DataRow( "type testType = string?", "type loose = string?", @@ -516,7 +516,7 @@ public void NullableTypes(string typeDeclaration, string expectedLooseSyntax, st RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, null); } - [DataTestMethod] + [TestMethod] // // storage Kind property // @@ -989,7 +989,7 @@ public void ResourcePropertyTypesAndResourceDerivedTypes(string resourceDeclarat RunTestFromResourceProperty(resourceDeclaration, resourcePropertyName, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, expectedResourceDerivedSyntax); } - [DataTestMethod] + [TestMethod] [DataRow( """ type t1 = { abc: int } @@ -1031,7 +1031,7 @@ public void NamedTypes(string typeDeclaration, string expectedLooseSyntax, strin RunTestFromTypeDeclaration(typeDeclaration, expectedLooseSyntax, expectedMediumStrictSyntax, expectedStrictSyntax, expectedResourceDerivedSyntax); } - [DataTestMethod] + [TestMethod] [DataRow( """ type negativeIntLiteral = -10 diff --git a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs index 79eebfb248d..36536a3b364 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs @@ -49,7 +49,7 @@ private static BicepCompilationManager GetTestBicepCompilationManager(Mock m.SendNotification(It.IsAny()), Times.Never); } - [DataTestMethod] + [TestMethod] [DataRow(".arm")] [DataRow(".json")] [DataRow(".jsonc")] @@ -116,7 +116,7 @@ public void UpsertCompilation_InWorspaceArmTemplateFile_ShouldRefreshWorkspace(s document.Verify(m => m.SendNotification(It.IsAny()), Times.Never); } - [DataTestMethod] + [TestMethod] [DataRow(LanguageConstants.LanguageId)] [DataRow(LanguageConstants.ParamsLanguageId)] public void UpsertCompilation_BicepFile_ShouldUpsertSuccessfully(string languageId) diff --git a/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs b/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs index d8969c62c72..b4d8148fd86 100644 --- a/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepCompletionProviderTests.cs @@ -442,7 +442,7 @@ public async Task VerifyParameterTypeCompletionWithPrecedingComment() }); } - [DataTestMethod] + [TestMethod] [DataRow("// |")] [DataRow("/* |")] [DataRow("param foo // |")] diff --git a/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs b/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs index ee80f4b5ce9..f187ce6b8bd 100644 --- a/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/BicepExternalSourceRequestHandlerTests.cs @@ -236,8 +236,8 @@ public void GetExternalSourceLinkUri_FullLink_WithSource_NoModuleBasePath() DecodeExternalSourceUri(result).FullTitle.Should().Be("br:myregistry.azurecr.io/module1:v1 -> entrypoint.bicep"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_TitlesShouldBeCorrect(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); @@ -273,16 +273,16 @@ public void GetExternalSourceLinkUri_WithRequestedFileInSubfolder_TitlesShouldBe ext.FullTitle.Should().Be("br:myregistry.azurecr.io/myrepo/bicep/module1:v1 -> subfolder1>subfolder 2>my file.bicep"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_ModuleReferenceShouldBeCorrect(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); DecodeExternalSourceUri(result).Components.ArtifactId.Should().Be($"{testData.Registry}/{testData.Repository}{testData.TagOrDigest}"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_RequestedFilenameShouldBeCorrect(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); @@ -290,32 +290,32 @@ public void GetExternalSourceLinkUri_RequestedFilenameShouldBeCorrect(ExternalSo DecodeExternalSourceUri(result).RequestedFile.Should().Be(expectedRequestedFile); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_ShouldStartWithExternalSourceScheme(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); result.ToString().Should().StartWith("bicep-extsrc:"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_ShouldStartWithBrOrTs(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); result.ToString().Should().MatchRegex("^bicep-extsrc:(br|ts)%3A", "external links should start with the scheme br: or ts:"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_ShouldBeFormedCorrectly(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); result.ToString().Should().MatchRegex("^(?[^#]+)#(?[^#]+)(?%23[^#]+)?$", "external link should have one # and optionally an encoded # after that"); } - [DataTestMethod] - [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] + [TestMethod] + [DynamicData(nameof(GetExternalSourceLinkTestData), DynamicDataDisplayNameDeclaringType = typeof(ExternalSourceLinkTestData))] public void GetExternalSourceLinkUri_RequestedFilenameShouldBeBicepOrJson(ExternalSourceLinkTestData testData) { Uri result = GetExternalSourceLinkUri(testData); diff --git a/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs b/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs index 067c8e26336..5fe6c311554 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/BicepCompletionContextTests.cs @@ -112,7 +112,7 @@ public void ShouldArrayItemTypeFlowThrough_False_WithinObject() } } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [|]")] [DataRow("var foo2 = [ | ]")] [DataRow("var foo3 = [| ]")] @@ -123,7 +123,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_Empty(string text) context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [,|]")] [DataRow("var foo2 = [, |]")] [DataRow("var foo3 = [|,]")] @@ -137,7 +137,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_Empty_Commas(string context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [|, aSymbol]")] [DataRow("var foo2 = [ |, aSymbol]")] [DataRow("var foo3 = [ | , aSymbol]")] @@ -148,7 +148,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_NonEmpty_FirstItem(s context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a first value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [aSymbol,|, aSymbol]")] [DataRow("var foo2 = [aSymbol, |, aSymbol]")] [DataRow("var foo3 = [aSymbol,| , aSymbol]")] @@ -161,7 +161,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_NonEmpty_MiddleItem( context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a middle value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [aSymbol,|]")] [DataRow("var foo2 = [aSymbol, |]")] [DataRow("var foo3 = [aSymbol, | ]")] @@ -172,7 +172,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_NonEmpty_LastItem(st context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a last value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = |[]")] [DataRow("var foo2 = []|")] [DataRow("var foo3 = |[aSymbol]")] @@ -187,7 +187,7 @@ public void ContextKind_IsNot_ArrayItem_SingleLineArray_Closed_Outside(string te context.Kind.Should().NotHaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is outside a closed single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [a|]")] [DataRow("var foo2 = [aSymbol, b|]")] [DataRow("var foo3 = [a|, bSymbol]")] @@ -200,7 +200,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_AtSymbol(string text context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("module dummy 'modules/dummy.bicep' |")] [DataRow("module dummy 'modules/dummy.bicep' | {}")] public void ContextKind_Is_ModulePathFollower(string text) @@ -210,7 +210,7 @@ public void ContextKind_Is_ModulePathFollower(string text) $"cursor in '{text}' should be a module path follower context"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [a |]")] [DataRow("var foo2 = [| a]")] [DataRow("var foo3 = [aSymbol, b |]")] @@ -223,7 +223,7 @@ public void ContextKind_Is_ArrayItem_SingleLineArray_Closed_NearSymbol(string te context.Kind.Should().HaveFlag(BicepCompletionContextKind.ArrayItem, $"cursor in {text} is a value area in a single line array"); } - [DataTestMethod] + [TestMethod] [DataRow("var foo1 = [(|)]")] [DataRow("var foo2 = [((|))]")] [DataRow("var foo3 = [(( | ))]")] diff --git a/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs b/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs index 35de2f188f5..8719ab05a4b 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/ModuleReferenceCompletionProviderTests.cs @@ -56,7 +56,7 @@ private static async Task> GetAndResolveCompletionIt return resolved; } - [DataTestMethod] + [TestMethod] [DataRow("module test |''", 14)] [DataRow("module test ''|", 14)] [DataRow("module test '|'", 14)] @@ -224,7 +224,7 @@ public async Task GetFilteredCompletions_WithInvalidTextInCompletionContext_Retu completions.Should().BeEmpty(); } - [DataTestMethod] + [TestMethod] // CONSIDER: This doesn't actually test anything useful because the current code takes the entire string // into account, and ignores where the cursor is. [DataRow("module test 'br/public:app/dapr-containerapp:1.0.1|")] @@ -257,7 +257,7 @@ public async Task GetFilteredCompletions_WithInvalidCompletionContext_ReturnsEmp completions.Should().BeEmpty(); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/|'", 17)] [DataRow("module test 'br/|", 16)] public async Task GetFilteredCompletions_WithAliasCompletionContext_ReturnsCompletionItems(string inputWithCursors, int expectedEnd) @@ -327,7 +327,7 @@ public async Task GetFilteredCompletions_WithAliasCompletionContext_ReturnsCompl }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:|'")] [DataRow("module test 'br:|")] public async Task GetFilteredCompletions_WithACRCompletionSettingSetToFalse_ReturnsACRCompletionItemsUsingBicepConfig(string inputWithCursors) @@ -392,7 +392,7 @@ public async Task GetFilteredCompletions_WithACRCompletionSettingSetToFalse_Retu }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:|'")] [DataRow("module test 'br:|")] public async Task GetFilteredCompletions_WithACRCompletionsSettingSetToTrue_ReturnsACRCompletionItemsUsingResourceGraphClient(string inputWithCursors) @@ -458,7 +458,7 @@ public async Task GetFilteredCompletions_WithACRCompletionsSettingSetToTrue_Retu }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:|'")] [DataRow("module test 'br:|")] public async Task GetFilteredCompletions_WithACRCompletionsSettingSetToTrue_AndNoAccessibleRegistries_ReturnsNoACRCompletions( @@ -492,7 +492,7 @@ public async Task GetFilteredCompletions_WithACRCompletionsSettingSetToTrue_AndN }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:mcr.microsoft.com/bicep/|'", "bicep/app/dapr-cntrapp1", "'br:mcr.microsoft.com/bicep/app/dapr-cntrapp1:$0'", "bicep/app/dapr-cntrapp2", "'br:mcr.microsoft.com/bicep/app/dapr-cntrapp2:$0'", 41)] [DataRow("module test 'br:mcr.microsoft.com/bicep/|", "bicep/app/dapr-cntrapp1", "'br:mcr.microsoft.com/bicep/app/dapr-cntrapp1:$0'", "bicep/app/dapr-cntrapp2", "'br:mcr.microsoft.com/bicep/app/dapr-cntrapp2:$0'", 40)] [DataRow("module test 'br/public:|'", "app/dapr-cntrapp1", "'br/public:app/dapr-cntrapp1:$0'", "app/dapr-cntrapp2", "'br/public:app/dapr-cntrapp2:$0'", 24)] @@ -551,7 +551,7 @@ public async Task GetFilteredCompletions_WithPublicMcrModuleRegistryCompletionCo }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:registry.contoso.io/bicep/|'", "bicep/whatever/abc/foo/bar", "'br:registry.contoso.io/bicep/whatever/abc/foo/bar:$0'")] [DataRow("module test 'br:registry.contoso.io/bicep/|", "bicep/whatever/abc/foo/bar", "'br:registry.contoso.io/bicep/whatever/abc/foo/bar:$0'")] [DataRow("module test 'br/myRegistry:|'", "abc/foo/bar", "'br/myRegistry:abc/foo/bar:$0'")] @@ -606,7 +606,7 @@ public async Task GetFilteredCompletions_WithPrivateModulePathCompletions_Return }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:testacr1.azurecr.io/|'", "bicep/modules", "'br:testacr1.azurecr.io/bicep/modules:$0'", 0, 12, 0, 37)] [DataRow("module test 'br:testacr1.azurecr.io/|", "bicep/modules", "'br:testacr1.azurecr.io/bicep/modules:$0'", 0, 12, 0, 36)] public async Task GetFilteredCompletions_IfAliasesInBicepConfig_AndRegistriesNotAvailable_GetPartialCompletionsBasedOnConfigOnly( @@ -656,7 +656,7 @@ public async Task GetFilteredCompletions_IfAliasesInBicepConfig_AndRegistriesNot }); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/public:app/dapr-containerapp:|'", "1.0.2", "'br/public:app/dapr-containerapp:1.0.2'$0", "0000", "1.0.1", "'br/public:app/dapr-containerapp:1.0.1'$0", "0001", 46)] [DataRow("module test 'br/public:app/dapr-containerapp:|", "1.0.2", "'br/public:app/dapr-containerapp:1.0.2'$0", "0000", "1.0.1", "'br/public:app/dapr-containerapp:1.0.1'$0", "0001", 45)] [DataRow("module test 'br:mcr.microsoft.com/bicep/app/dapr-containerapp:|'", "1.0.2", "'br:mcr.microsoft.com/bicep/app/dapr-containerapp:1.0.2'$0", "0000", "1.0.1", "'br:mcr.microsoft.com/bicep/app/dapr-containerapp:1.0.1'$0", "0001", 63)] @@ -754,7 +754,7 @@ public async Task GetFilteredCompletions_WithMcrVersionCompletionContext_AndNoMa completions.Should().BeEmpty(); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br:testacr1.azurecr.io/|'", "bicep/modules", "'br:testacr1.azurecr.io/bicep/modules:$0'", 0, 12, 0, 37)] [DataRow("module test 'br:testacr1.azurecr.io/|", "bicep/modules", "'br:testacr1.azurecr.io/bicep/modules:$0'", 0, 12, 0, 36)] public async Task GetFilteredCompletions_WithPublicAliasOverriddenInBicepConfigAndPathCompletionContext_ReturnsCompletionItems( @@ -800,7 +800,7 @@ public async Task GetFilteredCompletions_WithPublicAliasOverriddenInBicepConfigA x.TextEdit!.TextEdit!.Range.End.Character == endCharacter); } - [DataTestMethod] + [TestMethod] [DataRow("module test 'br/test1:|'", "dapr-containerapp", "'br/test1:dapr-containerapp:$0'", 0, 12, 0, 23)] [DataRow("module test 'br/test1:|", "dapr-containerapp", "'br/test1:dapr-containerapp:$0'", 0, 12, 0, 22)] [DataRow("module test 'br/test2:|'", "bicep/app/dapr-containerapp", "'br/test2:bicep/app/dapr-containerapp:$0'", 0, 12, 0, 23)] diff --git a/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs b/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs index 67ca7cee017..dd810c64554 100644 --- a/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs +++ b/src/Bicep.LangServer.UnitTests/Completions/ResourceTypeSearchKeywordsTests.cs @@ -32,7 +32,7 @@ public class ResourceTypeSearchKeywordsTests [DataRow("toplevel2/secondlevel2", null)] [DataRow("toplevel2/secondlevel2/thirdlevel", null)] [DataRow("toplevel2/secondlevel1/thirdlevel", "'toplevel2/secondlevel1/thirdlevel second level keyword'")] - [DataTestMethod] + [TestMethod] public void TryGetResourceTypeFilterText(string resourceType, string? expectedFilter) { var sut = new ResourceTypeSearchKeywords(new Dictionary @@ -124,7 +124,7 @@ no resources } """, "res-automation-job-schedule Automation Job Schedule Microsoft.Automation/automationAccounts Microsoft.Automation/automationAccounts/jobSchedules")] - [DataTestMethod] + [TestMethod] public void TryGetSnippetFilterText(string prefix, string detail, string text, string? expectedFilter) { var sut = new ResourceTypeSearchKeywords(new Dictionary diff --git a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs index 4e9db67c902..f49c6835595 100644 --- a/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs +++ b/src/Bicep.LangServer.UnitTests/Deploy/DeploymentHelperTests.cs @@ -30,7 +30,7 @@ public class DeploymentHelperTests [DataRow("")] [DataRow(" ")] [DataRow("invalid_scope")] - [DataTestMethod] + [TestMethod] public async Task StartDeploymentAsync_WithInvalidScope_ReturnsDeploymentFailedMessage(string scope) { var armClient = CreateMockArmClient(); @@ -67,7 +67,7 @@ public async Task StartDeploymentAsync_WithInvalidScope_ReturnsDeploymentFailedM [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task StartDeploymentAsync_WithSubscriptionScopeAndInvalidLocation_ReturnsDeploymentFailedMessage(string location) { var armClient = CreateMockArmClient(); @@ -98,7 +98,7 @@ public async Task StartDeploymentAsync_WithSubscriptionScopeAndInvalidLocation_R [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task StartDeploymentAsync_WithManagementGroupScopeAndInvalidLocation_ReturnsDeploymentFailedMessage(string location) { var armClient = CreateMockArmClient(); @@ -162,7 +162,7 @@ public async Task StartDeploymentAsync_WithTenantScope_ReturnsDeploymentNotSuppo [DataRow(LanguageConstants.TargetScopeTypeManagementGroup, "eastus")] [DataRow(LanguageConstants.TargetScopeTypeResourceGroup, "")] [DataRow(LanguageConstants.TargetScopeTypeSubscription, "eastus")] - [DataTestMethod] + [TestMethod] public async Task StartDeploymentAsync_WithValidScopeAndInput_ReturnsDeploymentSucceededMessage(string scope, string location) { var template = @"{ @@ -431,7 +431,7 @@ public async Task WaitForDeploymentCompletionAsync_WithStatusMessageOtherThan200 [DataRow(200)] [DataRow(201)] - [DataTestMethod] + [TestMethod] public async Task WaitForDeploymentCompletionAsync_WithStatusMessage200Or201_ReturnsDeploymentSucceededMessage(int status) { var responseMessage = "sample response"; diff --git a/src/Bicep.LangServer.UnitTests/Features/Visualization/VisualResourceCreationServiceTests.cs b/src/Bicep.LangServer.UnitTests/Features/Visualization/VisualResourceCreationServiceTests.cs index cd5dce70cd3..4abeaccc38c 100644 --- a/src/Bicep.LangServer.UnitTests/Features/Visualization/VisualResourceCreationServiceTests.cs +++ b/src/Bicep.LangServer.UnitTests/Features/Visualization/VisualResourceCreationServiceTests.cs @@ -37,7 +37,7 @@ public class VisualResourceCreationServiceTests #region DeriveBaseSymbolicName - [DataTestMethod] + [TestMethod] [DataRow("Microsoft.Storage/storageAccounts", "storageAccount")] [DataRow("Microsoft.Compute/virtualMachines", "virtualMachine")] [DataRow("Microsoft.Network/loadBalancers", "loadBalancer")] diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs index 647da70e9a9..e99987d85d4 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepBuildCommandHandlerTests.cs @@ -37,7 +37,7 @@ private static BicepBuildCommandHandler CreateHandler(ICompilationManager compil [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task Handle_WithInvalidPath_ShouldThrowArgumentException(string path) { ICompilationManager bicepCompilationManager = StrictMock.Of().Object; @@ -184,7 +184,7 @@ public async Task Handle_WithValidPath_AndNoErrorsInInputFile_ReturnsBuildSuccee [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public void TemplateContainsBicepGeneratorMetadata_WithInvalidInput_ReturnsFalse(string template) { ICompilationManager bicepCompilationManager = StrictMock.Of().Object; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs index 08d8d515156..e88619078e5 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileCommandHandlerTests.cs @@ -250,7 +250,7 @@ private static (BicepDecompileCommandHandler, BicepDecompileSaveCommandHandler) [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task WithInvalidPath_ShouldThrowArgumentException(string path) { var server = new LanguageServerMock(); diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs index 87646bc33e8..f8f686e43ce 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteBicepParamsCommandHandlerTests.cs @@ -131,7 +131,7 @@ private async Task TestDecompileForPaste(Options options) #endregion - [DataTestMethod] + [TestMethod] [DataRow( jsonFullParamsTemplate, PasteType.FullParams, @@ -289,7 +289,7 @@ await TestDecompileForPaste( } - [DataTestMethod] + [TestMethod] [DataRow( """ "just a string with double quotes" @@ -454,7 +454,7 @@ await TestDecompileForPaste( expectedBicep: expectedBicep); } - [DataTestMethod] + [TestMethod] [DataRow( """ { @@ -533,7 +533,7 @@ await TestDecompileForPaste( expectedBicep: null); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ abc: 1, def: 'def' }", // this is not technically valid JSON but the Newtonsoft parser accepts it anyway and it is already valid Bicep PasteType.BicepValue, // Valid json and valid Bicep expression @@ -709,7 +709,7 @@ await TestDecompileForPaste( ); } - [DataTestMethod] + [TestMethod] [DataRow( """ |using '' diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs index 5770bbc0ce5..4a245348d5f 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDecompileForPasteCommandHandlerTests.cs @@ -168,7 +168,7 @@ private async Task TestDecompileForPaste(Options options) #endregion - [DataTestMethod] + [TestMethod] [DataRow( jsonFullTemplate, PasteType.FullTemplate, @@ -376,7 +376,7 @@ await TestDecompileForPaste( expectedBicep: null); } - [DataTestMethod] + [TestMethod] [DataRow( @" { @@ -1257,7 +1257,7 @@ await TestDecompileForPaste( "); } - [DataTestMethod] + [TestMethod] [DataRow( @"""just a string with double quotes""", @"'just a string with double quotes'", @@ -1390,7 +1390,7 @@ await TestDecompileForPaste( expectedBicep: expectedBicep); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ ipConfigurations: [ @@ -1463,7 +1463,7 @@ await TestDecompileForPaste( expectedBicep: null); } - [DataTestMethod] + [TestMethod] [DataRow( @"{ abc: 1, def: 'def' }", // this is not technically valid JSON but the Newtonsoft parser accepts it anyway and it is already valid Bicep PasteType.BicepValue, // Valid json and valid Bicep expression @@ -1603,7 +1603,7 @@ await TestDecompileForPaste( expectedBicep: null); } - [DataTestMethod] + [TestMethod] [DataRow( @"|@description('bicep string') param s string", diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs index fb2c9d7a254..e81f00a4da9 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentParametersHandlerTests.cs @@ -756,7 +756,7 @@ public async Task Handle_WithValidInput_VerifyNoEntryInDeploymentFileCompilation Assert.IsNull(DeploymentFileCompilationCache.FindAndRemoveCompilation(documentUri)); } - [DataTestMethod] + [TestMethod] [DataRow("param test string = 'test'", ParameterType.String)] [DataRow("param test int = 1", ParameterType.Int)] [DataRow("param test bool = true", ParameterType.Bool)] @@ -789,7 +789,7 @@ public async Task VerifyParameterType(string bicepFileContents, ParameterType? e result.Should().Be(expected); } - [DataTestMethod] + [TestMethod] [DataRow(null)] [DataRow("")] [DataRow(" ")] diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs index d1417e0a837..1c39ae3977e 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepDeploymentScopeRequestHandlerTests.cs @@ -132,7 +132,7 @@ public async Task Handle_WithValidInputFile_ReturnsBicepDeploymentScopeResponse( [DataRow(LanguageConstants.TargetScopeTypeSubscription, LanguageConstants.TargetScopeTypeSubscription)] [DataRow(LanguageConstants.TargetScopeTypeTenant, LanguageConstants.TargetScopeTypeTenant)] [DataRow("Invalid_Scope", "None")] - [DataTestMethod] + [TestMethod] public async Task Handle_WithValidInputFile_VerifyDeploymentScope(string scope, string result) { string bicepFileContents = @"targetScope = '" + scope + "\'" + "\n" + diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs index e3ce6610c57..56cd76a737d 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepForceModulesRestoreCommandHandlerTests.cs @@ -36,7 +36,7 @@ private static BicepForceModulesRestoreCommandHandler CreateHandler(ICompilation [DataRow(null)] [DataRow("")] [DataRow(" ")] - [DataTestMethod] + [TestMethod] public async Task Handle_WithInvalidPath_ShouldThrowArgumentException(string path) { var compilationManager = StrictMock.Of().Object; diff --git a/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs b/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs index 763946b2a53..dfeb8c3ee9a 100644 --- a/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs +++ b/src/Bicep.LangServer.UnitTests/Handlers/BicepGetRecommendedConfigLocationHandlerTests.cs @@ -153,8 +153,8 @@ private static IEnumerable GetWorkspaceFoldersTestData() #endif } - [DataTestMethod] - [DynamicData(nameof(GetWorkspaceFoldersTestData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetWorkspaceFoldersTestData))] public void WorkspaceFolders(string[] workspaceFolders, string bicepFilePath, string expected) { var actual = BicepGetRecommendedConfigLocationHandler.GetRecommendedConfigFileLocation(workspaceFolders, bicepFilePath); diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs index bd64668fe60..e72ef65162c 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetCacheTests.cs @@ -118,7 +118,7 @@ public async Task GetDescriptionAndSnippetText_WithCommentAndMissingDeclarations text.Should().Be(string.Empty); } - [DataTestMethod] + [TestMethod] [DataRow("", "")] [DataRow(" ", " ")] public void RemoveSnippetPlaceholderComments_WithInvalidInput_ReturnsInputTextAsIs(string input, string expected) diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs index 7681ad14f8b..c2d2e8e734c 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetTests.cs @@ -11,7 +11,7 @@ public class SnippetTests { [DataRow("")] [DataRow("var foo")] - [DataTestMethod] + [TestMethod] public void SnippetsWithoutPlaceholdersShouldParse(string text) { var snippet = new Snippet(text); diff --git a/src/Bicep.Local.Deploy.IntegrationTests/ProviderExtensionTests.cs b/src/Bicep.Local.Deploy.IntegrationTests/ProviderExtensionTests.cs index b2014b23d55..30496eb45f2 100644 --- a/src/Bicep.Local.Deploy.IntegrationTests/ProviderExtensionTests.cs +++ b/src/Bicep.Local.Deploy.IntegrationTests/ProviderExtensionTests.cs @@ -110,7 +110,7 @@ public class AppsDeploymentResource } [TestMethod] - [DynamicData(nameof(GetDataSets), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetDataSets))] public async Task Save_request_works_as_expected(ChannelMode mode) { string[] processArgs; diff --git a/src/Bicep.MSBuild.UnitTests/BicepDiagnosticParserTests.cs b/src/Bicep.MSBuild.UnitTests/BicepDiagnosticParserTests.cs index 555c9c254ae..3c0687b79de 100644 --- a/src/Bicep.MSBuild.UnitTests/BicepDiagnosticParserTests.cs +++ b/src/Bicep.MSBuild.UnitTests/BicepDiagnosticParserTests.cs @@ -15,7 +15,7 @@ public class BicepDiagnosticParserTests [DataRow("X:\\hello\\there\\main.bicep(1,12) : Warning use-recent-module-versions: Use a more recent version of module 'fake/avm/res/app/container-app1a'. The most recent version is 0.2.0. *", "X:\\hello\\there\\main.bicep(1,12)", "Warning", "use-recent-module-versions", "Use a more recent version of module 'fake/avm/res/app/container-app1a'. The most recent version is 0.2.0. *")] [DataRow("/users/test/subdir/main.bicep(1,12) : Warning use-recent-module-versions: Use a more recent version of module 'fake/avm/res/app/container-app1a'. The most recent version is 0.2.0. *", "/users/test/subdir/main.bicep(1,12)", "Warning", "use-recent-module-versions", "Use a more recent version of module 'fake/avm/res/app/container-app1a'. The most recent version is 0.2.0. *")] [DataRow("main.bicep(2,2) : Info FAKE: Made up informational diagnostic.", "main.bicep(2,2)", "Info", "FAKE", "Made up informational diagnostic.")] - [DataTestMethod] + [TestMethod] public void ParserCanParseAndReconstructBicepDiagnostics(string line, string expectedOrigin, string expectedCategory, string expectedCode, string expectedText) { var result = BicepDiagnosticParser.TryParseDiagnostic(line); diff --git a/src/Bicep.McpServer.UnitTests/BicepToolsTests.cs b/src/Bicep.McpServer.UnitTests/BicepToolsTests.cs index a950dc1c106..6c9e1f149ae 100644 --- a/src/Bicep.McpServer.UnitTests/BicepToolsTests.cs +++ b/src/Bicep.McpServer.UnitTests/BicepToolsTests.cs @@ -36,8 +36,8 @@ public void ListAzureResourceTypes_returns_list_of_resource_types() var result = response.ResourceTypes; result.Should().HaveCountGreaterThan(700); - result.Should().AllSatisfy(x => x.Split('/').First().Equals("Microsoft.Compute", StringComparison.OrdinalIgnoreCase)) - .And.AllSatisfy(x => x.Contains('@')); + result.Should().AllSatisfy(x => x.Split('/').First().Should().BeEquivalentTo("Microsoft.Compute")) + .And.AllSatisfy(x => x.Should().Contain("@")); } [TestMethod] diff --git a/src/Bicep.RegistryModuleTool.IntegrationTests/Commands/GenerateCommandTests.cs b/src/Bicep.RegistryModuleTool.IntegrationTests/Commands/GenerateCommandTests.cs index d916166f1c1..80c2c9fb351 100644 --- a/src/Bicep.RegistryModuleTool.IntegrationTests/Commands/GenerateCommandTests.cs +++ b/src/Bicep.RegistryModuleTool.IntegrationTests/Commands/GenerateCommandTests.cs @@ -20,8 +20,8 @@ namespace Bicep.RegistryModuleTool.IntegrationTests.Commands [TestClass] public class GenerateCommandTests { - [DataTestMethod] - [DynamicData(nameof(GetSuccessData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetSuccessData))] public async Task InvokeAsync_OnSuccess_ReturnsZero(MockFileSystem fileSystemBeforeGeneration, MockFileSystem _) { var sut = CreateGenerateCommand(fileSystemBeforeGeneration); @@ -31,8 +31,8 @@ public async Task InvokeAsync_OnSuccess_ReturnsZero(MockFileSystem fileSystemBef exitCode.Should().Be(0); } - [DataTestMethod] - [DynamicData(nameof(GetSuccessData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetSuccessData))] public async Task InvokeAsync_OnSuccess_ProducesExpectedFiles(MockFileSystem fileSystemBeforeGeneration, MockFileSystem fileSystemAfterGeneration) { var sut = CreateGenerateCommand(fileSystemBeforeGeneration); @@ -42,8 +42,8 @@ public async Task InvokeAsync_OnSuccess_ProducesExpectedFiles(MockFileSystem fil fileSystemBeforeGeneration.Should().HaveSameFilesAs(fileSystemAfterGeneration); } - [DataTestMethod] - [DynamicData(nameof(GetSuccessData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetSuccessData))] public async Task InvokeAsync_RepeatOnSuccess_ProducesSameFiles(MockFileSystem fileSystemBeforeGeneration, MockFileSystem fileSystemAfterGeneration) { var sut = CreateGenerateCommand(fileSystemBeforeGeneration); diff --git a/src/Bicep.RegistryModuleTool.TestFixtures/Bicep.RegistryModuleTool.TestFixtures.csproj b/src/Bicep.RegistryModuleTool.TestFixtures/Bicep.RegistryModuleTool.TestFixtures.csproj index 94447bb40c7..d2cbba1791b 100644 --- a/src/Bicep.RegistryModuleTool.TestFixtures/Bicep.RegistryModuleTool.TestFixtures.csproj +++ b/src/Bicep.RegistryModuleTool.TestFixtures/Bicep.RegistryModuleTool.TestFixtures.csproj @@ -4,6 +4,8 @@ enable + + false false diff --git a/src/Bicep.RegistryModuleTool.UnitTests/Extensions/ITypeReferenceExtensionsTests.cs b/src/Bicep.RegistryModuleTool.UnitTests/Extensions/ITypeReferenceExtensionsTests.cs index f3f323547ed..da49169042a 100644 --- a/src/Bicep.RegistryModuleTool.UnitTests/Extensions/ITypeReferenceExtensionsTests.cs +++ b/src/Bicep.RegistryModuleTool.UnitTests/Extensions/ITypeReferenceExtensionsTests.cs @@ -14,8 +14,8 @@ namespace Bicep.RegistryModuleTool.UnitTests.Extensions [TestClass] public class ITypeReferenceExtensionsTests { - [DataTestMethod] - [DynamicData(nameof(GetTestData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetTestData))] public void GetPrimitiveTypeName_PossibleParameterOrOutputTypes_ReturnsPrimitiveTypeName(ITypeReference typeReference, string expectedPrimitiveTypeName) { var actual = typeReference.GetPrimitiveTypeName(); diff --git a/src/Bicep.RegistryModuleTool.UnitTests/ModuleFiles/BaseCommandHandlerTests.cs b/src/Bicep.RegistryModuleTool.UnitTests/ModuleFiles/BaseCommandHandlerTests.cs index 6000161dfa6..0e8e503fe73 100644 --- a/src/Bicep.RegistryModuleTool.UnitTests/ModuleFiles/BaseCommandHandlerTests.cs +++ b/src/Bicep.RegistryModuleTool.UnitTests/ModuleFiles/BaseCommandHandlerTests.cs @@ -23,8 +23,8 @@ public async Task InvokeAsync_NoException_Passthrough() exitCode.Should().Be(100); } - [DataTestMethod] - [DynamicData(nameof(GetExceptionData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetExceptionData))] public async Task InvokeAsync_CaughtException_ReturnsOne(Exception exceptionToThrow) { var exitCode = await InvokeAsync(new ThrowExceptionCommandHandler(exceptionToThrow)); @@ -32,8 +32,8 @@ public async Task InvokeAsync_CaughtException_ReturnsOne(Exception exceptionToTh exitCode.Should().Be(1); } - [DataTestMethod] - [DynamicData(nameof(GetExpectedExceptionData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetExpectedExceptionData))] public async Task InvokeAsync_CaughtExpectedException_LogsDebug(Exception exceptionToThrow) { var logger = MockLoggerFactory.CreateLogger(); @@ -48,8 +48,8 @@ public async Task InvokeAsync_CaughtExpectedException_LogsDebug(Exception except It.IsAny>())); } - [DataTestMethod] - [DynamicData(nameof(GetUnexpectedExceptionData), DynamicDataSourceType.Method)] + [TestMethod] + [DynamicData(nameof(GetUnexpectedExceptionData))] public async Task InvokeAsync_CaughtUnexpectedException_LogsCritical(Exception exceptionToThrow) { var logger = MockLoggerFactory.CreateLogger(); diff --git a/src/Bicep.RpcClient.Tests/Bicep.RpcClient.Tests.csproj b/src/Bicep.RpcClient.Tests/Bicep.RpcClient.Tests.csproj index c2a03e6e019..e26030434ca 100644 --- a/src/Bicep.RpcClient.Tests/Bicep.RpcClient.Tests.csproj +++ b/src/Bicep.RpcClient.Tests/Bicep.RpcClient.Tests.csproj @@ -27,4 +27,21 @@ + + + + bicep.exe + bicep + $(MSBuildThisFileDirectory)../Bicep.Cli/bin/$(Configuration)/$(TargetFramework)/$(BicepExeName) + $(OutDir)$(BicepExeName) + + + + + + + + diff --git a/src/Bicep.RpcClient.Tests/BicepClientTests.cs b/src/Bicep.RpcClient.Tests/BicepClientTests.cs index 5f28bd1fc2e..8172ad30547 100644 --- a/src/Bicep.RpcClient.Tests/BicepClientTests.cs +++ b/src/Bicep.RpcClient.Tests/BicepClientTests.cs @@ -182,7 +182,7 @@ await FluentActions.Invoking(() => clientFactory.Initialize(new() { BicepVersion .Should().ThrowAsync().WithMessage("Invalid Bicep version format 'v0.1.1'. Expected format: 'x.y.z' where x, y, and z are integers."); } - [DataTestMethod] + [TestMethod] [DataRow("1.2", "Invalid Bicep version format '1.2'. Expected format: 'x.y.z' where x, y, and z are integers.")] [DataRow("v1.2.3", "Invalid Bicep version format 'v1.2.3'. Expected format: 'x.y.z' where x, y, and z are integers.")] [DataRow("1.2.3.4", "Invalid Bicep version format '1.2.3.4'. Expected format: 'x.y.z' where x, y, and z are integers.")] @@ -193,7 +193,7 @@ public void Validate_throws_for_invalid_BicepVersion(string version, string expe .Should().Throw().WithMessage(expectedMessage); } - [DataTestMethod] + [TestMethod] [DataRow("1.2.3")] [DataRow("0.0.0")] [DataRow("100.200.300")] diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 082e7bb736a..b391528687b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -39,7 +39,9 @@ - + + + @@ -104,8 +106,8 @@ - - + + diff --git a/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/MiddleLayerProviders/HandleSnippetCompletionsMiddleLayerTests.cs b/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/MiddleLayerProviders/HandleSnippetCompletionsMiddleLayerTests.cs index 8614cdc42c5..22b04264f3e 100644 --- a/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/MiddleLayerProviders/HandleSnippetCompletionsMiddleLayerTests.cs +++ b/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/MiddleLayerProviders/HandleSnippetCompletionsMiddleLayerTests.cs @@ -11,7 +11,7 @@ namespace Bicep.VSLanguageServerClient.UnitTests.MiddleLayerProviders [TestClass] public class HandleSnippetCompletionsMiddleLayerTests { - [DataTestMethod] + [TestMethod] [DataRow(null)] [DataRow("")] [DataRow(" ")] @@ -113,7 +113,7 @@ public void GetUpdatedCompletionItem_WithChoiceSnippetSyntaxInCompletionItem_Con textEdit!.NewText.Should().Be(expectedInsertText); } - [DataTestMethod] + [TestMethod] [DataRow("17.3.345678", true)] [DataRow("17.3.11", true)] [DataRow("17.4.123", true)] diff --git a/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/Telemetry/TelemetryCustomMessageTargetTests.cs b/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/Telemetry/TelemetryCustomMessageTargetTests.cs index db3421f830d..f6fca266c0e 100644 --- a/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/Telemetry/TelemetryCustomMessageTargetTests.cs +++ b/src/vs-bicep/Bicep.VSLanguageServerClient.UnitTests/Telemetry/TelemetryCustomMessageTargetTests.cs @@ -17,7 +17,7 @@ public class TelemetryCustomMessageTargetTests [DataRow(@"{ ""a"": 1 }")] [DataRow(@"{ ""eventName"": """" }")] [DataRow(@"{ ""eventName"": "" "" }")] - [DataTestMethod] + [TestMethod] [Ignore] // TODO: Fix (https://github.com/Azure/bicep/issues/14251) public void GetTelemetryEvent_WithInvalidInput_ShouldReturnNull(string input) {