Skip to content

Commit 858839f

Browse files
committed
- SkippableFact package removed.
1 parent a93e7f0 commit 858839f

File tree

155 files changed

+986
-926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+986
-926
lines changed

tests/MongoDB.Bson.TestHelpers/MongoDB.Bson.TestHelpers.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
<PackageReference Include="FluentAssertions" Version="4.12.0" />
3838
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.2" />
3939
<PackageReference Include="xunit" Version="2.4.2" />
40-
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
4140
<PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />
41+
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13">
42+
<PrivateAssets>all</PrivateAssets>
43+
</PackageReference>
4244
</ItemGroup>
4345

4446
<ItemGroup>

tests/MongoDB.Bson.Tests/MongoDB.Bson.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<PackageReference Include="Moq" Version="4.9.0" />
6565
<PackageReference Include="xunit" Version="2.4.2" />
6666
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
67+
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
6768
<PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />
6869
</ItemGroup>
6970

tests/MongoDB.Driver.Core.TestHelpers/MongoDB.Driver.Core.TestHelpers.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.2" />
5555
<PackageReference Include="xunit" Version="2.4.2" />
5656
<PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />
57-
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
5857
</ItemGroup>
5958

6059
<ItemGroup>

tests/MongoDB.Driver.Core.TestHelpers/XunitExtensions/RequirePlatform.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System;
1717
using System.Linq;
1818
using Xunit;
19+
using Xunit.Sdk;
1920

2021
namespace MongoDB.Driver.TestHelpers
2122
{

tests/MongoDB.Driver.Core.TestHelpers/XunitExtensions/RequireServer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using MongoDB.Driver.Core.Clusters;
2020
using MongoDB.Driver.Core.Misc;
2121
using Xunit;
22+
using Xunit.Sdk;
2223

2324
namespace MongoDB.Driver.Core.TestHelpers.XunitExtensions
2425
{
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* Copyright 2021-present MongoDB Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using System.Linq;
17+
using MongoDB.Driver.Core.Misc;
18+
using Xunit.Abstractions;
19+
using Xunit.Sdk;
20+
21+
namespace MongoDB.Driver.Core.TestHelpers.XunitExtensions.TimeoutEnforcing
22+
{
23+
internal sealed class SkippableTestMessageBus : IMessageBus
24+
{
25+
private readonly static string __skippableExceptionName = typeof(SkipException).FullName;
26+
27+
private readonly IMessageBus _messageBus;
28+
private int _skippedCount;
29+
30+
public SkippableTestMessageBus(IMessageBus messageBus)
31+
{
32+
_messageBus = Ensure.IsNotNull(messageBus, nameof(messageBus));
33+
}
34+
35+
public int SkippedCount => _skippedCount;
36+
37+
public void Dispose()
38+
{
39+
_messageBus.Dispose();
40+
}
41+
42+
/// <inheritdoc />
43+
public bool QueueMessage(IMessageSinkMessage message)
44+
{
45+
var failed = message as TestFailed;
46+
if (message is TestFailed testFailed &&
47+
testFailed.ExceptionTypes.FirstOrDefault() == __skippableExceptionName)
48+
{
49+
_skippedCount++;
50+
return _messageBus.QueueMessage(new TestSkipped(failed.Test, failed.Messages[0]));
51+
}
52+
53+
return _messageBus.QueueMessage(message);
54+
}
55+
}
56+
}

tests/MongoDB.Driver.Core.TestHelpers/XunitExtensions/TimeoutEnforcing/TimeoutEnforcingTestInvoker.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using System.Threading;
2121
using System.Threading.Tasks;
2222
using MongoDB.Driver.Core.TestHelpers.Logging;
23-
using Xunit;
2423
using Xunit.Abstractions;
2524
using Xunit.Sdk;
2625

@@ -76,7 +75,7 @@ protected override async Task<decimal> InvokeTestMethodAsync(object testClassIns
7675
{
7776
var exception = Aggregator.ToException();
7877

79-
if (exception is not Xunit.SkipException)
78+
if (exception is not SkipException)
8079
{
8180
testLoggable.OnException(exception);
8281
}

tests/MongoDB.Driver.Core.TestHelpers/XunitExtensions/TimeoutEnforcing/TimeoutEnforcingXunitTestMethodRunner.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ namespace MongoDB.Driver.Core.TestHelpers.XunitExtensions.TimeoutEnforcing
2525
[DebuggerStepThrough]
2626
internal sealed class TimeoutEnforcingXunitTestMethodRunner : XunitTestMethodRunner
2727
{
28-
private static string[] __skippingExceptionNames = new string[]
29-
{
30-
typeof(Xunit.SkipException).FullName,
31-
typeof(Xunit.Sdk.SkipException).FullName
32-
};
33-
3428
private readonly object[] _constructorArguments;
3529
private readonly IMessageSink _diagnosticMessageSink;
3630

@@ -42,7 +36,7 @@ public TimeoutEnforcingXunitTestMethodRunner(ITestMethod testMethod, IReflection
4236

4337
protected override async Task<RunSummary> RunTestCaseAsync(IXunitTestCase originalTestCase)
4438
{
45-
var messageBusInterceptor = new SkippableTestMessageBus(MessageBus, __skippingExceptionNames);
39+
var messageBusInterceptor = new SkippableTestMessageBus(MessageBus);
4640

4741
var isTheory = originalTestCase is XunitTheoryTestCase;
4842
XunitTestCaseRunner testRunner = isTheory ?

tests/MongoDB.Driver.Core.Tests/Core/Authentication/Libgssapi/GssapiSecurityCredentialTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public GssapiSecurityCredentialTests()
4040
}
4141
}
4242

43-
[SkippableFact]
43+
[Fact]
4444
public void Should_acquire_gssapi_security_credential_with_username_and_password()
4545
{
4646
RequireEnvironment.Check().EnvironmentVariable("GSSAPI_TESTS_ENABLED");
@@ -50,7 +50,7 @@ public void Should_acquire_gssapi_security_credential_with_username_and_password
5050
credential.Should().NotBeNull();
5151
}
5252

53-
[SkippableFact]
53+
[Fact]
5454
public void Should_acquire_gssapi_security_credential_with_username_only()
5555
{
5656
RequireEnvironment.Check().EnvironmentVariable("GSSAPI_TESTS_ENABLED");
@@ -59,7 +59,7 @@ public void Should_acquire_gssapi_security_credential_with_username_only()
5959
credential.Should().NotBeNull();
6060
}
6161

62-
[SkippableFact]
62+
[Fact]
6363
public void Should_fail_to_acquire_gssapi_security_credential_with_username_and_bad_password()
6464
{
6565
RequireEnvironment.Check().EnvironmentVariable("GSSAPI_TESTS_ENABLED");

tests/MongoDB.Driver.Core.Tests/Core/Bindings/CoreSessionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void Dispose_should_have_expected_result(
226226
Mock.Get(subject.ServerSession).Verify(m => m.Dispose(), Times.Once);
227227
}
228228

229-
[SkippableFact]
229+
[Fact]
230230
public void StartTransaction_should_throw_when_write_concern_is_unacknowledged()
231231
{
232232
RequireServer.Check().ClusterType(ClusterType.ReplicaSet).Supports(Feature.Transactions);

tests/MongoDB.Driver.Core.Tests/Core/Connections/TcpStreamFactoryTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void CreateStream_should_throw_when_connect_timeout_has_expired(
137137
action.ShouldThrow<TimeoutException>();
138138
}
139139

140-
[SkippableTheory]
140+
[Theory]
141141
[ParameterAttributeData]
142142
public void CreateStream_should_call_the_socketConfigurator(
143143
[Values(false, true)]
@@ -162,7 +162,7 @@ public void CreateStream_should_call_the_socketConfigurator(
162162
socketConfiguratorWasCalled.Should().BeTrue();
163163
}
164164

165-
[SkippableTheory]
165+
[Theory]
166166
[ParameterAttributeData]
167167
public void CreateStream_should_connect_to_a_running_server_and_return_a_non_null_stream(
168168
[Values(false, true)]
@@ -185,7 +185,7 @@ public void CreateStream_should_connect_to_a_running_server_and_return_a_non_nul
185185
stream.Should().NotBeNull();
186186
}
187187

188-
[SkippableTheory]
188+
[Theory]
189189
[ParameterAttributeData]
190190
public void SocketConfigurator_can_be_used_to_set_keepAlive(
191191
[Values(false, true)]

tests/MongoDB.Driver.Core.Tests/Core/Misc/WireVersionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace MongoDB.Driver.Core.Tests.Core.Misc
2323
{
2424
public class WireVersionTests
2525
{
26-
[SkippableFact]
26+
[Fact]
2727
public void Server_maxWireVersion_should_be_in_supported_range()
2828
{
2929
RequireServer.Check().StableServer(stable: true);

tests/MongoDB.Driver.Core.Tests/Core/Operations/AggregateExplainOperationTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void CreateCommand_should_return_expected_result()
162162
result.Should().Be(expectedResult);
163163
}
164164

165-
[SkippableTheory]
165+
[Theory]
166166
[ParameterAttributeData]
167167
public void CreateCommand_should_return_expected_result_when_AllowDiskUse_is_set(
168168
[Values(false, true)]
@@ -185,7 +185,7 @@ public void CreateCommand_should_return_expected_result_when_AllowDiskUse_is_set
185185
result.Should().Be(expectedResult);
186186
}
187187

188-
[SkippableTheory]
188+
[Theory]
189189
[ParameterAttributeData]
190190
public void CreateCommand_should_return_expected_result_when_Collation_is_set(
191191
[Values("en_US", "fr_CA")]
@@ -283,7 +283,7 @@ public void CreateCommand_should_return_expected_result_when_MaxTime_is_set(long
283283
result["maxTimeMS"].BsonType.Should().Be(BsonType.Int32);
284284
}
285285

286-
[SkippableTheory]
286+
[Theory]
287287
[ParameterAttributeData]
288288
public void Execute_should_return_expected_result(
289289
[Values(false, true)]
@@ -297,7 +297,7 @@ public void Execute_should_return_expected_result(
297297
result.Should().NotBeNull();
298298
}
299299

300-
[SkippableTheory]
300+
[Theory]
301301
[ParameterAttributeData]
302302
public void Execute_should_return_expected_result_when_AllowDiskUse_is_set(
303303
[Values(false, true)]
@@ -314,7 +314,7 @@ public void Execute_should_return_expected_result_when_AllowDiskUse_is_set(
314314
result.Should().NotBeNull();
315315
}
316316

317-
[SkippableTheory]
317+
[Theory]
318318
[ParameterAttributeData]
319319
public void Execute_should_return_expected_result_when_Collation_is_set(
320320
[Values(false, true)]
@@ -331,7 +331,7 @@ public void Execute_should_return_expected_result_when_Collation_is_set(
331331
result.Should().NotBeNull();
332332
}
333333

334-
[SkippableTheory]
334+
[Theory]
335335
[ParameterAttributeData]
336336
public void Execute_should_throw_when_maxTime_is_exceeded(
337337
[Values(false, true)] bool async)
@@ -348,7 +348,7 @@ public void Execute_should_throw_when_maxTime_is_exceeded(
348348
}
349349
}
350350

351-
[SkippableTheory]
351+
[Theory]
352352
[ParameterAttributeData]
353353
public void Execute_should_return_expected_result_when_Comment_is_set(
354354
[Values(false, true)]
@@ -372,7 +372,7 @@ public void Execute_should_return_expected_result_when_Comment_is_set(
372372
}
373373
}
374374

375-
[SkippableTheory]
375+
[Theory]
376376
[ParameterAttributeData]
377377
public void Execute_should_return_expected_result_when_Hint_is_set(
378378
[Values(false, true)]
@@ -389,7 +389,7 @@ public void Execute_should_return_expected_result_when_Hint_is_set(
389389
result.Should().NotBeNull();
390390
}
391391

392-
[SkippableTheory]
392+
[Theory]
393393
[ParameterAttributeData]
394394
public void Execute_should_return_expected_result_when_MaxTime_is_set(
395395
[Values(false, true)]
@@ -406,7 +406,7 @@ public void Execute_should_return_expected_result_when_MaxTime_is_set(
406406
result.Should().NotBeNull();
407407
}
408408

409-
[SkippableTheory]
409+
[Theory]
410410
[ParameterAttributeData]
411411
public void Execute_should_send_session_id_when_supported(
412412
[Values(false, true)] bool async)

0 commit comments

Comments
 (0)