Skip to content

Commit beb05db

Browse files
Bump to Xunit 2.9.2 (#3820)
1 parent 12f18dc commit beb05db

File tree

7 files changed

+29
-16
lines changed

7 files changed

+29
-16
lines changed

.github/actions/environment/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ runs:
1111
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
1212
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
1313
14+
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
15+
- name: Pin the Xcode Version
16+
if: runner.os == 'macOS'
17+
shell: bash
18+
run: sudo xcode-select --switch /Applications/Xcode_16.0.app
19+
1420
# Needed for Android SDK setup step
1521
- uses: actions/setup-java@v3
1622
with:

test/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
<PackageReference Include="NSubstitute" Version="5.1.0" />
5050
<PackageReference Include="FluentAssertions" Version="6.12.0" />
51-
<PackageReference Include="xunit" Version="2.6.5" />
51+
<PackageReference Include="xunit" Version="2.9.2" />
5252
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
5353
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
5454
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="20.0.4" />

test/Sentry.AspNetCore.Tests/SentryMiddlewareTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public void PopulateScope_DoesNotDuplicateEventProcessorsWhenPopulateMultipleTim
806806
sut.PopulateScope(_fixture.HttpContext, scope);
807807
sut.PopulateScope(_fixture.HttpContext, scope);
808808

809-
Assert.Single(scope.GetAllEventProcessors().Where(c => c == customProcessor));
809+
Assert.Single(scope.GetAllEventProcessors(), c => c == customProcessor);
810810
}
811811

812812
[Fact]
@@ -841,7 +841,7 @@ public void PopulateScope_DoesNotDuplicateExceptionEventProcessorsWhenPopulateMu
841841
sut.PopulateScope(_fixture.HttpContext, scope);
842842
sut.PopulateScope(_fixture.HttpContext, scope);
843843

844-
Assert.Single(scope.GetAllExceptionProcessors().Where(c => c == customEventExceptionProcessor));
844+
Assert.Single(scope.GetAllExceptionProcessors(), c => c == customEventExceptionProcessor);
845845
}
846846

847847
[Fact]
@@ -876,6 +876,6 @@ public void PopulateScope_DoesNotDuplicateTransactionProcessorsWhenPopulateMulti
876876
sut.PopulateScope(_fixture.HttpContext, scope);
877877
sut.PopulateScope(_fixture.HttpContext, scope);
878878

879-
Assert.Single(scope.GetAllTransactionProcessors().Where(c => c == customTransactionProcessor));
879+
Assert.Single(scope.GetAllTransactionProcessors(), c => c == customTransactionProcessor);
880880
}
881881
}

test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public void EfCoreIntegration_RunSynchronousQueryWithIssue_TransactionWithSpans(
9090
Assert.Single(spans); //1 command
9191
#else
9292
Assert.Equal(2, spans.Count); //1 query compiler, 1 command
93-
Assert.Single(spans.Where(s => s.Status == SpanStatus.Ok && s.Operation == "db.query.compile"));
93+
Assert.Single(spans, s => s is { Status: SpanStatus.Ok, Operation: "db.query.compile" });
9494
#endif
95-
Assert.Single(spans.Where(s => s.Status == SpanStatus.InternalError && s.Operation == "db.query"));
95+
Assert.Single(spans, s => s is { Status: SpanStatus.InternalError, Operation: "db.query" });
9696
Assert.All(spans, span => Assert.True(span.IsFinished));
9797
}
9898

test/Sentry.EntityFramework.Tests/SentryQueryPerformanceListenerTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ public void FirstOrDefault_FromDatabase_CapturesQuery()
210210
// This operation will result in one reading operation and two non scalar operations.
211211
_fixture.Hub.Received(3).GetSpan();
212212
// In-memory database doesn't have a CommandText so Description is expected to be null
213-
Assert.NotEmpty(_fixture.Spans.Where(
214-
span => DbNonQueryKey == span.Operation && span.Description is "CREATE SCHEMA (CodeFirstDatabase(dbo.__MigrationHistory(ContextKey(Effort.string)MigrationId(Effort.string)Model(Effort.binary)ProductVersion(Effort.string))))"));
215-
Assert.NotEmpty(_fixture.Spans.Where(
216-
span => DbNonQueryKey == span.Operation && span.Description is null));
217-
Assert.NotEmpty(_fixture.Spans.Where(
218-
span => DbReaderKey == span.Operation && span.Description is null));
213+
Assert.Contains(_fixture.Spans,
214+
span => DbNonQueryKey == span.Operation &&
215+
span.Description is
216+
"CREATE SCHEMA (CodeFirstDatabase(dbo.__MigrationHistory(ContextKey(Effort.string)MigrationId(Effort.string)Model(Effort.binary)ProductVersion(Effort.string))))");
217+
Assert.Contains(_fixture.Spans, span => DbNonQueryKey == span.Operation && span.Description is null);
218+
Assert.Contains(_fixture.Spans, span => DbReaderKey == span.Operation && span.Description is null);
219219

220220
Assert.All(_fixture.Spans, span => span.Received(1).Finish(Arg.Is<SpanStatus>(status => SpanStatus.Ok == status)));
221221
integration.Unregister();

test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
<ItemGroup>
8282
<PackageReference Include="DeviceRunners.XHarness.Maui" Version="0.1.0-preview.1" />
8383
<PackageReference Include="DeviceRunners.XHarness.Xunit" Version="0.1.0-preview.1" />
84+
<!-- Prevent downgrade of these packages for DeviceRunners.XHarness.Xunit 0.1.0-preview.1 -->
85+
<PackageReference Include="System.Net.Primitives" Version="4.3.0" />
86+
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
8487
</ItemGroup>
8588

8689
<ItemGroup>

test/Sentry.Tests/Internals/MainExceptionProcessorTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public void Process_ExceptionWithout_Handled()
5151

5252
sut.Process(exp, evt);
5353

54-
Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == null));
54+
Assert.NotNull(evt.SentryExceptions);
55+
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == null);
5556
}
5657

5758
[Fact]
@@ -65,7 +66,8 @@ public void Process_ExceptionWith_HandledFalse()
6566

6667
sut.Process(exp, evt);
6768

68-
Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == false));
69+
Assert.NotNull(evt.SentryExceptions);
70+
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == false);
6971
}
7072

7173
[Fact]
@@ -79,7 +81,8 @@ public void Process_ExceptionWith_HandledTrue()
7981

8082
sut.Process(exp, evt);
8183

82-
Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == true));
84+
Assert.NotNull(evt.SentryExceptions);
85+
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == true);
8386
}
8487

8588
[Fact]
@@ -91,7 +94,8 @@ public void Process_ExceptionWith_HandledTrue_WhenCaught()
9194

9295
sut.Process(exp, evt);
9396

94-
Assert.Single(evt.SentryExceptions!.Where(p => p.Mechanism?.Handled == true));
97+
Assert.NotNull(evt.SentryExceptions);
98+
Assert.Single(evt.SentryExceptions, p => p.Mechanism?.Handled == true);
9599
}
96100

97101
[Fact]

0 commit comments

Comments
 (0)