Skip to content

Commit 0e674f6

Browse files
committed
fix some more CommandEventHelperTests
1 parent 823deee commit 0e674f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Microsoft.Extensions.Logging;
1818
using MongoDB.Bson;
1919
using MongoDB.Bson.TestHelpers;
20+
using MongoDB.Driver.Core.Configuration;
2021
using MongoDB.TestHelpers.XunitExtensions;
2122
using MongoDB.Driver.Core.Events;
2223
using MongoDB.Driver.Core.Logging;
@@ -56,7 +57,8 @@ public void ShouldRedactCommand_should_return_expected_result(string commandJson
5657
public void ShouldTrackState_should_be_correct(
5758
[Values(false, true)] bool logCommands,
5859
[Values(false, true)] bool captureCommandSucceeded,
59-
[Values(false, true)] bool captureCommandFailed)
60+
[Values(false, true)] bool captureCommandFailed,
61+
[Values(false, true)] bool traceCommands)
6062
{
6163
var mockLogger = new Mock<ILogger<LogCategories.Command>>();
6264
mockLogger.Setup(m => m.IsEnabled(LogLevel.Debug)).Returns(logCommands);
@@ -74,9 +76,10 @@ public void ShouldTrackState_should_be_correct(
7476
}
7577

7678
var eventLogger = new EventLogger<LogCategories.Command>(eventCapturer, mockLogger.Object);
77-
var commandHelper = new CommandEventHelper(eventLogger);
79+
var tracingOptions = traceCommands ? new TracingOptions() : new TracingOptions { Disabled = true };
80+
var commandHelper = new CommandEventHelper(eventLogger, tracingOptions);
7881

79-
commandHelper._shouldTrackState().Should().Be(logCommands || captureCommandSucceeded || captureCommandFailed);
82+
commandHelper._shouldTrackState().Should().Be(logCommands || captureCommandSucceeded || captureCommandFailed || traceCommands);
8083
}
8184
}
8285

0 commit comments

Comments
 (0)