Skip to content
Open
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"allowPrerelease": false,
"version": "10.0.301",
"rollForward": "latestPatch"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
2 changes: 1 addition & 1 deletion src/Bicep.Core.UnitTests/Assertions/BaselineHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Core.UnitTests/Extensions/StringExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void ExtractRegexGroups_ByGroupNames_Valid(string s, string regex, string
[DataTestMethod]
public void ExtractRegexGroups_ByGroupNames_Invalid(string s, string regex, string[] groupNames, string expectedError)
{
var ex = Assert.ThrowsException<Exception>(() => s.ExtractRegexGroups(regex, groupNames));
var ex = Assert.Throws<Exception>(() => s.ExtractRegexGroups(regex, groupNames));
ex.Message.Should().Be(nameof(StringExtensions.ExtractRegexGroups) + ": " + expectedError);
}

Expand Down Expand Up @@ -91,7 +91,7 @@ public void ExtractRegexGroups_AllGroups_Valid(string s, string regex, string[]
[DataTestMethod]
public void ExtractRegexGroups_AllGroups_Invalid(string s, string regex, string expectedError)
{
var ex = Assert.ThrowsException<Exception>(() => s.ExtractRegexGroups(regex));
var ex = Assert.Throws<Exception>(() => s.ExtractRegexGroups(regex));
ex.Message.Should().Be(nameof(StringExtensions.ExtractRegexGroups) + ": " + expectedError);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ 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}");
}
}

Expand All @@ -78,7 +78,7 @@ 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}.");
}
}

Expand All @@ -91,7 +91,7 @@ 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}.");
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- NU5104: A stable release of a package should not have a prerelease dependency -->
<NoWarn>$(NoWarn);NU5104</NoWarn>
<!-- MSTest 4.x introduces new analyzer rules that fire on existing code; suppress until code is migrated -->
<!-- TODO: migrate existing tests and remove these suppressions -->
<!-- MSTEST0044: [DataTestMethod] is obsolete, use [TestMethod] instead -->
<!-- MSTEST0052: Remove the DynamicDataSourceType argument (auto-detect is now the default) -->
<!-- MSTEST0055: Return value of string/collection method should not be ignored -->
<!-- MSTEST0065: Assert.AreEqual on IEnumerable does not perform element-wise comparison -->
<!-- MSTEST0017: Assertion arguments should be passed in the correct order (NOTE: fix any real issues before removing this suppression) -->
<NoWarn>$(NoWarn);MSTEST0017;MSTEST0044;MSTEST0052;MSTEST0055;MSTEST0065</NoWarn>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- Bubble up all unused usings https://github.com/dotnet/roslyn/issues/41640#issuecomment-985780130 -->
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<PackageVersion Include="JsonSchema.Net" Version="7.3.3" />
<PackageVersion Include="Microsoft.Playwright" Version="1.56.0" />
<PackageVersion Include="Microsoft.Playwright.Xunit" Version="1.56.0" />
<PackageVersion Include="MSTest" Version="3.9.2" />
<PackageVersion Include="MSTest" Version="4.3.0" />
<PackageVersion Include="Markdig" Version="1.3.2" />
<PackageVersion Include="MessagePack" Version="3.1.7" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.9" />
Expand Down
Loading