Skip to content

Commit 53ffdd5

Browse files
Increase the test coverage
1 parent c38aab4 commit 53ffdd5

27 files changed

+247
-247
lines changed

mcp_nexus_tests/Caching/CacheEvictionManagerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ public void Dispose()
3939
[Fact]
4040
public void Constructor_WithNullLogger_ThrowsArgumentNullException()
4141
{
42-
Assert.Throws<ArgumentNullException>(() =>
42+
Assert.Throws<ArgumentNullException>(() =>
4343
new CacheEvictionManager<string, object>(null!, _config, _cache));
4444
}
4545

4646
[Fact]
4747
public void Constructor_WithNullConfig_ThrowsArgumentNullException()
4848
{
49-
Assert.Throws<ArgumentNullException>(() =>
49+
Assert.Throws<ArgumentNullException>(() =>
5050
new CacheEvictionManager<string, object>(_mockLogger.Object, null!, _cache));
5151
}
5252

5353
[Fact]
5454
public void Constructor_WithNullCache_ThrowsArgumentNullException()
5555
{
56-
Assert.Throws<ArgumentNullException>(() =>
56+
Assert.Throws<ArgumentNullException>(() =>
5757
new CacheEvictionManager<string, object>(_mockLogger.Object, _config, null!));
5858
}
5959

mcp_nexus_tests/CommandQueue/BasicCommandProcessorTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@ public BasicCommandProcessorTests()
3232
public void Constructor_WithNullCdbSession_ThrowsArgumentNullException()
3333
{
3434
// Act & Assert
35-
Assert.Throws<ArgumentNullException>(() =>
35+
Assert.Throws<ArgumentNullException>(() =>
3636
new BasicCommandProcessor(null!, _mockLogger.Object, _config, _activeCommands));
3737
}
3838

3939
[Fact]
4040
public void Constructor_WithNullLogger_ThrowsArgumentNullException()
4141
{
4242
// Act & Assert
43-
Assert.Throws<ArgumentNullException>(() =>
43+
Assert.Throws<ArgumentNullException>(() =>
4444
new BasicCommandProcessor(_mockCdbSession.Object, null!, _config, _activeCommands));
4545
}
4646

4747
[Fact]
4848
public void Constructor_WithNullConfig_ThrowsArgumentNullException()
4949
{
5050
// Act & Assert
51-
Assert.Throws<ArgumentNullException>(() =>
51+
Assert.Throws<ArgumentNullException>(() =>
5252
new BasicCommandProcessor(_mockCdbSession.Object, _mockLogger.Object, null!, _activeCommands));
5353
}
5454

5555
[Fact]
5656
public void Constructor_WithNullActiveCommands_ThrowsArgumentNullException()
5757
{
5858
// Act & Assert
59-
Assert.Throws<ArgumentNullException>(() =>
59+
Assert.Throws<ArgumentNullException>(() =>
6060
new BasicCommandProcessor(_mockCdbSession.Object, _mockLogger.Object, _config, null!));
6161
}
6262

@@ -95,7 +95,7 @@ public async Task ProcessCommandQueueAsync_WithSingleCommand_ProcessesSuccessful
9595
var cancellationTokenSource = new CancellationTokenSource();
9696
var completionSource = new TaskCompletionSource<string>();
9797
var queuedCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow, completionSource, cancellationTokenSource);
98-
98+
9999
commandQueue.Add(queuedCommand);
100100
commandQueue.CompleteAdding();
101101

@@ -122,7 +122,7 @@ public async Task ProcessCommandQueueAsync_WithFailingCommand_HandlesFailure()
122122
var cancellationTokenSource = new CancellationTokenSource();
123123
var completionSource = new TaskCompletionSource<string>();
124124
var queuedCommand = new QueuedCommand("cmd-1", "!invalid", DateTime.UtcNow, completionSource, cancellationTokenSource);
125-
125+
126126
commandQueue.Add(queuedCommand);
127127
commandQueue.CompleteAdding();
128128

@@ -150,7 +150,7 @@ public async Task ProcessCommandQueueAsync_WithCancelledCommand_HandlesCancellat
150150
var commandCancellationTokenSource = new CancellationTokenSource();
151151
var completionSource = new TaskCompletionSource<string>();
152152
var queuedCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow, completionSource, commandCancellationTokenSource);
153-
153+
154154
commandQueue.Add(queuedCommand);
155155
commandQueue.CompleteAdding();
156156

@@ -179,7 +179,7 @@ public async Task ProcessCommandQueueAsync_WithServiceShutdown_HandlesCancellati
179179
var commandCancellationTokenSource = new CancellationTokenSource();
180180
var completionSource = new TaskCompletionSource<string>();
181181
var queuedCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow, completionSource, commandCancellationTokenSource);
182-
182+
183183
commandQueue.Add(queuedCommand);
184184
commandQueue.CompleteAdding();
185185

@@ -194,7 +194,7 @@ public async Task ProcessCommandQueueAsync_WithServiceShutdown_HandlesCancellati
194194

195195
// Act - Start processing and then cancel the service
196196
var processingTask = _processor.ProcessCommandQueueAsync(commandQueue, serviceCancellationTokenSource.Token);
197-
197+
198198
// Cancel the service after a short delay to allow processing to start
199199
await Task.Delay(100);
200200
serviceCancellationTokenSource.Cancel();
@@ -239,7 +239,7 @@ public void TriggerCleanup_RemovesCompletedCommands()
239239
var completionSource = new TaskCompletionSource<string>();
240240
var cancellationTokenSource = new CancellationTokenSource();
241241
var oldCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow.AddHours(-2), completionSource, cancellationTokenSource, CommandState.Completed);
242-
242+
243243
_activeCommands["cmd-1"] = oldCommand;
244244

245245
// Act
@@ -256,7 +256,7 @@ public void TriggerCleanup_KeepsRecentCommands()
256256
var completionSource = new TaskCompletionSource<string>();
257257
var cancellationTokenSource = new CancellationTokenSource();
258258
var recentCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow, completionSource, cancellationTokenSource, CommandState.Completed);
259-
259+
260260
_activeCommands["cmd-1"] = recentCommand;
261261

262262
// Act
@@ -273,7 +273,7 @@ public void TriggerCleanup_KeepsExecutingCommands()
273273
var completionSource = new TaskCompletionSource<string>();
274274
var cancellationTokenSource = new CancellationTokenSource();
275275
var executingCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow.AddHours(-2), completionSource, cancellationTokenSource, CommandState.Executing);
276-
276+
277277
_activeCommands["cmd-1"] = executingCommand;
278278

279279
// Act

mcp_nexus_tests/CommandQueue/CommandNotificationManagerTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ public CommandNotificationManagerTests()
2828
public void Constructor_WithNullNotificationService_ThrowsArgumentNullException()
2929
{
3030
// Act & Assert
31-
Assert.Throws<ArgumentNullException>(() =>
31+
Assert.Throws<ArgumentNullException>(() =>
3232
new CommandNotificationManager(null!, _mockLogger.Object, _config));
3333
}
3434

3535
[Fact]
3636
public void Constructor_WithNullLogger_ThrowsArgumentNullException()
3737
{
3838
// Act & Assert
39-
Assert.Throws<ArgumentNullException>(() =>
39+
Assert.Throws<ArgumentNullException>(() =>
4040
new CommandNotificationManager(_mockNotificationService.Object, null!, _config));
4141
}
4242

4343
[Fact]
4444
public void Constructor_WithNullConfig_ThrowsArgumentNullException()
4545
{
4646
// Act & Assert
47-
Assert.Throws<ArgumentNullException>(() =>
47+
Assert.Throws<ArgumentNullException>(() =>
4848
new CommandNotificationManager(_mockNotificationService.Object, _mockLogger.Object, null!));
4949
}
5050

@@ -145,9 +145,9 @@ public async Task NotifyCommandHeartbeatFireAndForget_WithQueuedCommand_CallsNot
145145
// Wait for the Task.Run to complete
146146
await Task.Delay(2000);
147147
_mockNotificationService.Verify(x => x.NotifyCommandStatusAsync(
148-
It.IsAny<string>(),
149-
It.IsAny<string>(),
150-
It.Is<string>(s => s.Contains("Executing for 5") && s.Contains("minutes")),
148+
It.IsAny<string>(),
149+
It.IsAny<string>(),
150+
It.Is<string>(s => s.Contains("Executing for 5") && s.Contains("minutes")),
151151
It.IsAny<int?>(),
152152
It.IsAny<string>(),
153153
It.IsAny<string>(),
@@ -170,9 +170,9 @@ public async Task NotifyCommandHeartbeatFireAndForget_WithLongElapsedTime_CapsPr
170170
// Wait for the Task.Run to complete
171171
await Task.Delay(1000);
172172
_mockNotificationService.Verify(x => x.NotifyCommandStatusAsync(
173-
It.IsAny<string>(),
174-
It.IsAny<string>(),
175-
It.IsAny<string>(),
173+
It.IsAny<string>(),
174+
It.IsAny<string>(),
175+
It.IsAny<string>(),
176176
It.Is<int?>(p => p <= 95),
177177
It.IsAny<string>(),
178178
It.IsAny<string>(),
@@ -341,7 +341,7 @@ public async Task NotifyCommandStatusFireAndForget_WithExceptionInNotificationSe
341341
var commandId = "cmd-1";
342342
var command = "!analyze -v";
343343
var status = "executing";
344-
344+
345345
_mockNotificationService.Setup(x => x.NotifyCommandStatusAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
346346
.ThrowsAsync(new Exception("Notification failed"));
347347

@@ -367,7 +367,7 @@ public async Task NotifyCommandHeartbeatFireAndForget_WithExceptionInNotificatio
367367
var cancellationTokenSource = new CancellationTokenSource();
368368
var queuedCommand = new QueuedCommand("cmd-1", "!analyze -v", DateTime.UtcNow, completionSource, cancellationTokenSource);
369369
var elapsed = TimeSpan.FromMinutes(5);
370-
370+
371371
_mockNotificationService.Setup(x => x.NotifyCommandStatusAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
372372
.ThrowsAsync(new Exception("Notification failed"));
373373

0 commit comments

Comments
 (0)