Skip to content

Commit

Permalink
Update NuGet packages for Tests project (based on File/New xUnit proj…
Browse files Browse the repository at this point in the history
…ect)
  • Loading branch information
christophwille committed Jan 30, 2024
1 parent 21f3123 commit 1856b78
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tests/CSharp/TriviaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ End Sub
var conversionResult = await ProjectConversion.ConvertTextAsync<VBToCSConversion>(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);
}
}
14 changes: 5 additions & 9 deletions Tests/TestRunners/ConverterTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -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:");
Expand All @@ -182,8 +180,7 @@ private static (IReadOnlyCollection<string> Lines, IReadOnlyCollection<string> L
{
var lines = Utils.HomogenizeEol(code).Split(new[] { Environment.NewLine }, StringSplitOptions.None);
var lineNumbersAdded = new List<string>();
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;
Expand All @@ -207,8 +204,7 @@ public CSToVBWithoutSimplifierConversion()

string ILanguageConversion.TargetLanguage => _baseConversion.TargetLanguage;

ConversionOptions ILanguageConversion.ConversionOptions
{
ConversionOptions ILanguageConversion.ConversionOptions {
get => _baseConversion.ConversionOptions;
set => _baseConversion.ConversionOptions = value;
}
Expand Down
9 changes: 7 additions & 2 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
<ItemGroup>
<PackageReference Include="Moq" Version="4.18.3" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
Expand Down

0 comments on commit 1856b78

Please sign in to comment.