Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump xunit and related fixes #350

Merged
merged 10 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/GraphQLParser.Tests/GraphQLParser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(SingleTestPlatform)' != 'true'">
<TargetFrameworks>netcoreapp3.1;net5;net6;net7</TargetFrameworks>
<TargetFrameworks>net6;net7</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,8 +27,8 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/GraphQLParser.Tests/Visitors/ASTVisitorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ public void ASTVisitor_Should_Handle_Null()
}

[Fact]
public void ASTVisitor_Should_Throw_On_Unknown_Node()
public async Task ASTVisitor_Should_Throw_On_Unknown_Node()
{
var visitor = new ASTVisitor<Context>();
var context = new Context();

var ex = Should.Throw<NotSupportedException>(() => visitor.VisitAsync(new MySuperNode(), context).GetAwaiter().GetResult());
var ex = await Should.ThrowAsync<NotSupportedException>(async () => await visitor.VisitAsync(new MySuperNode(), context));
sungam3r marked this conversation as resolved.
Show resolved Hide resolved
ex.Message.ShouldBe("Unknown node 'MySuperNode'.");
}

[Fact]
public void ASTVisitor_Should_Pass_CancellationToken()
public async Task ASTVisitor_Should_Pass_CancellationToken()
{
var document = "scalar JSON".Parse();
var visitor = new MyVisitor();
using var cts = new CancellationTokenSource(500);
var context = new Context { CancellationToken = cts.Token };
context.CancellationToken.ThrowIfCancellationRequested();

Should.Throw<OperationCanceledException>(() => visitor.VisitAsync(document, context).GetAwaiter().GetResult());
await Should.ThrowAsync<OperationCanceledException>(async () => await visitor.VisitAsync(document, context));
}

private sealed class MyVisitor : ASTVisitor<Context>
Expand Down
4 changes: 2 additions & 2 deletions src/GraphQLParser.Tests/Visitors/CountVisitorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task CountVisitor_Should_Count_Nodes(string text, int expectedCount

var document = text.Parse();

await visitor.VisitAsync(document, context).ConfigureAwait(false);
await visitor.VisitAsync(document, context);
sungam3r marked this conversation as resolved.
Show resolved Hide resolved
context.Count.ShouldBe(expectedCount);
document.AllNestedCount().ShouldBe(expectedCount);
}
Expand All @@ -55,7 +55,7 @@ public async Task CountVisitor_Should_Count_Zero_Nodes(string text)

var document = text.Parse();

await visitor.VisitAsync(document, context).ConfigureAwait(false);
await visitor.VisitAsync(document, context);
context.Count.ShouldBe(0);
}
}
2 changes: 1 addition & 1 deletion src/GraphQLParser.Tests/Visitors/MaxDepthVisitorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task MaxDepthVisitor_Should_Work(string text, int expectedMaxDepth)

var document = text.Parse();

await visitor.VisitAsync(document, context).ConfigureAwait(false);
await visitor.VisitAsync(document, context);
context.MaxDepth.ShouldBe(expectedMaxDepth);
document.MaxNestedDepth().ShouldBe(expectedMaxDepth);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ public async Task SDLPrinter_Should_Print_Document(
var writer = new StringWriter();
var document = text.Parse();

await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected, $"Test {number} failed");

Expand Down Expand Up @@ -924,7 +924,7 @@ public async Task SDLPrinter_Should_Print_BlockStrings(int number, string input,
var document = (input + " scalar a").Parse();

var printer = new SDLPrinter();
await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var renderedOriginal = writer.ToString();

var lines = renderedOriginal.Split(Environment.NewLine);
Expand Down Expand Up @@ -955,7 +955,7 @@ public async Task SDLPrinter_Should_Print_EscapedStrings(string stringValue)
var document = query.Parse();

var printer = new SDLPrinter();
await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var rendered = writer.ToString();
rendered.ShouldBe(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task Printer_Should_Print_Pretty_If_Directives_Skipped(
var writer = new StringWriter();
var document = text.Parse();

await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected, $"Test {number} failed");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public async Task Printer_Should_Print_Pretty_If_Definitions_Skipped(
var writer = new StringWriter();
var document = text.Parse();

await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected, $"Test {number} failed");

Expand Down
8 changes: 4 additions & 4 deletions src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public async Task StructurePrinter_Should_Print_Tree(string text, string expecte
{
var writer = new StringWriter();
var document = text.Parse();
await _structPrinter1.PrintAsync(document, writer).ConfigureAwait(false);
await _structPrinter1.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected);
}
Expand All @@ -304,7 +304,7 @@ public async Task StructurePrinter_Should_Print_Tree_Without_Names(string text,
{
var writer = new StringWriter();
var document = text.Parse();
await _structPrinter2.PrintAsync(document, writer).ConfigureAwait(false);
await _structPrinter2.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected);
}
Expand Down Expand Up @@ -550,7 +550,7 @@ public async Task StructurePrinter_Should_Print_Tree_With_Locations(string text,
var writer = new StringWriter();

var document = text.Parse(new ParserOptions { Ignore = option });
await _structPrinter3.PrintAsync(document, writer).ConfigureAwait(false);
await _structPrinter3.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected);
}
Expand Down Expand Up @@ -587,7 +587,7 @@ public async Task StructurePrinter_Should_Print_Tree_With_Custom_Indentation(str

var document = text.Parse(new ParserOptions { Ignore = option });
var printer = new StructurePrinter(new StructurePrinterOptions { PrintNames = false, IndentSize = indentSize });
await printer.PrintAsync(document, writer).ConfigureAwait(false);
await printer.PrintAsync(document, writer);
var actual = writer.ToString();
actual.ShouldBe(expected);
}
Expand Down