diff --git a/Tests/CSharp/TriviaTests.cs b/Tests/CSharp/TriviaTests.cs index 4e91a3c62..6aa15dfa9 100644 --- a/Tests/CSharp/TriviaTests.cs +++ b/Tests/CSharp/TriviaTests.cs @@ -424,7 +424,7 @@ End Sub var conversionResult = await ProjectConversion.ConvertTextAsync(vbCode, options); var regex = new Regex(@"#error Cannot convert \w+ - see comment for details\s+ \/\* Cannot convert.*?\*\/", RegexOptions.Singleline); - Assert.Equal(1, conversionResult.Exceptions.Count); + Assert.Single(conversionResult.Exceptions); Assert.Matches(regex, conversionResult.ConvertedCode); } } \ No newline at end of file diff --git a/Tests/TestRunners/ConverterTestBase.cs b/Tests/TestRunners/ConverterTestBase.cs index cb67c6960..fbd3ce668 100644 --- a/Tests/TestRunners/ConverterTestBase.cs +++ b/Tests/TestRunners/ConverterTestBase.cs @@ -74,7 +74,7 @@ private static bool LineCanHaveCSharpComment(string l) .Skip(1).Select(afterPrefix => afterPrefix.Split('\n')[0].TrimEnd()).ToList(); var missingSourceLineNumbers = lineNumbersAdded.Except(convertedCommentLineNumbers); if (missingSourceLineNumbers.Any()) { - Assert.False(true, "Comments not converted from source lines: " + string.Join(", ", missingSourceLineNumbers) + GetSourceAndConverted(sourceWithComments, convertedCode)); + Assert.Fail("Comments not converted from source lines: " + string.Join(", ", missingSourceLineNumbers) + GetSourceAndConverted(sourceWithComments, convertedCode)); } OurAssert.Equal(string.Join(", ", lineNumbersAdded), string.Join(", ", convertedCommentLineNumbers), () => GetSourceAndConverted(sourceWithComments, convertedCode)); } @@ -107,8 +107,7 @@ public async Task TestConversionVisualBasicToCSharpAsync(string visualBasicCode, bool incompatibleWithAutomatedCommentTesting = false) { if (expectSurroundingBlock) expectedCsharpCode = SurroundWithBlock(expectedCsharpCode); - var conversionOptions = new TextConversionOptions(DefaultReferences.NetStandard2) - { + var conversionOptions = new TextConversionOptions(DefaultReferences.NetStandard2) { RootNamespaceOverride = _rootNamespace, ShowCompilationErrors = !expectSurroundingBlock }; @@ -163,8 +162,7 @@ private static void AssertConvertedCodeResultEquals(string convertedCodeFollowed private static void AssertCodeEqual(string originalSource, string expectedConversion, string actualConversion) { - OurAssert.EqualIgnoringNewlines(expectedConversion, actualConversion, () => - { + OurAssert.EqualIgnoringNewlines(expectedConversion, actualConversion, () => { StringBuilder sb = OurAssert.DescribeStringDiff(expectedConversion, actualConversion); sb.AppendLine(OurAssert.LineSplitter); sb.AppendLine("source:"); @@ -182,8 +180,7 @@ private static (IReadOnlyCollection Lines, IReadOnlyCollection L { var lines = Utils.HomogenizeEol(code).Split(new[] { Environment.NewLine }, StringSplitOptions.None); var lineNumbersAdded = new List(); - var newLines = lines.Select((line, i) => - { + var newLines = lines.Select((line, i) => { var lineNumber = i.ToString(); var potentialExistingComments = line.Split(new[] { singleLineCommentStart }, StringSplitOptions.None).Skip(1); if (potentialExistingComments.Count() == 1 || !lineCanHaveComment(line)) return line; @@ -207,8 +204,7 @@ public CSToVBWithoutSimplifierConversion() string ILanguageConversion.TargetLanguage => _baseConversion.TargetLanguage; - ConversionOptions ILanguageConversion.ConversionOptions - { + ConversionOptions ILanguageConversion.ConversionOptions { get => _baseConversion.ConversionOptions; set => _baseConversion.ConversionOptions = value; } diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 0ea2bd3a5..647e04d44 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -11,11 +11,16 @@ - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive + + runtime; build; native; contentfiles; analyzers; buildtransitive + all +