Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ updates:
patterns:
- "NUnit*"
- "coverlet*"
ignore:
# 6.3.x makes Microsoft.Testing.Extensions.CodeCoverage statically
# instrument every DLL under the repo root instead of the test bin dir,
# so parallel test hosts rewrite each other's binaries and CI hangs.
- dependency-name: "NUnit3TestAdapter"
versions: ["6.3.0", "6.3.1"]

- package-ecosystem: github-actions
directory: /
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="FsCheck" Version="3.4.0" />
<PackageVersion Include="FsCheck.NUnit" Version="3.0.0-rc3" />
<PackageVersion Include="NUnit" Version="4.6.1" />
<PackageVersion Include="NUnit" Version="5.0.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.11.0" />
<!-- Explicit version to fix NUnit3TestAdapter binding issue -->
Expand Down
1 change: 0 additions & 1 deletion tests/SharpDicom.Codecs.Tests/NativeCodecsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void IsAvailable_BeforeInitialize_ReturnsFalse()
#if NET5_0_OR_GREATER
[Test]
[Category("NativeCodecs")]
[Order(0)] // Run this test first to check initialization before other tests
public void InitializeWithCustomPath_WhenLibraryExists_Succeeds()
{
// This test explicitly passes the library path to Initialize
Expand Down
2 changes: 1 addition & 1 deletion tests/SharpDicom.Tests/Cli/LintCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public async Task InvalidUidFile_StrictProfile_ThrowsOnError()
};

// Strict mode throws on invalid UIDs rather than collecting them
Assert.ThrowsAsync<SharpDicom.Data.Exceptions.DicomDataException>(
await Assert.ThrowsAsync<SharpDicom.Data.Exceptions.DicomDataException>(
async () => await DicomFile.OpenAsync(path, options));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public async Task BatchDeidentifier_InvalidInputDir_ThrowsDirectoryNotFoundExcep
var config = DeidentificationConfigLoader.GetPreset("basic-profile");
await using var batch = new BatchDeidentifier(_dbPath, config);

Assert.ThrowsAsync<DirectoryNotFoundException>(async () =>
await Assert.ThrowsAsync<DirectoryNotFoundException>(async () =>
{
await batch.ProcessDirectoryAsync("/nonexistent/path", _outputDir);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/SharpDicom.Tests/IO/DicomFileReaderSequenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task ReadElementsAsync_FileWithSequence_YieldsSequenceElement()

// Assert - should have the sequence
Assert.That(elements, Has.Some.Matches<IDicomElement>(e =>
e.Tag == new DicomTag(0x0040, 0x0100) && e is DicomSequence));
e is DicomSequence sequence && sequence.Tag == new DicomTag(0x0040, 0x0100)));
}

[Test]
Expand Down Expand Up @@ -128,7 +128,7 @@ public async Task ReadElementsAsync_ImplicitVRFileWithSequence_ParsesCorrectly()

// Assert - should have the sequence
Assert.That(elements, Has.Some.Matches<IDicomElement>(e =>
e.Tag == new DicomTag(0x0040, 0x0100) && e is DicomSequence));
e is DicomSequence sequence && sequence.Tag == new DicomTag(0x0040, 0x0100)));
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions tests/SharpDicom.Tests/IO/DicomFileReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task ReadFileMetaInfoAsync_EmptyFile_Throws()

await using var reader = new DicomFileReader(stream);

Assert.ThrowsAsync<DicomFileException>(async () =>
await Assert.ThrowsAsync<DicomFileException>(async () =>
await reader.ReadFileMetaInfoAsync());
}

Expand Down Expand Up @@ -106,7 +106,7 @@ public async Task ReadElementsAsync_RespectsCancellation()
cts.Cancel();

// TaskCanceledException is a subclass of OperationCanceledException
var ex = Assert.CatchAsync<OperationCanceledException>(async () =>
var ex = await Assert.CatchAsync<OperationCanceledException>(async () =>
{
await foreach (var _ in reader.ReadElementsAsync(cts.Token))
{
Expand Down Expand Up @@ -219,7 +219,7 @@ public async Task AfterDispose_ReadThrows()
var reader = new DicomFileReader(stream);
await reader.DisposeAsync();

Assert.ThrowsAsync<ObjectDisposedException>(async () =>
await Assert.ThrowsAsync<ObjectDisposedException>(async () =>
await reader.ReadFileMetaInfoAsync());
}

Expand Down
8 changes: 4 additions & 4 deletions tests/SharpDicom.Tests/IO/PixelDataSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,24 +354,24 @@ public void SkippedPixelDataSource_GetData_ThrowsInvalidOperationException()
}

[Test]
public void SkippedPixelDataSource_GetDataAsync_ThrowsInvalidOperationException()
public async Task SkippedPixelDataSource_GetDataAsync_ThrowsInvalidOperationException()
{
// Arrange
using var source = new SkippedPixelDataSource(0, 100);

// Act & Assert
Assert.ThrowsAsync<InvalidOperationException>(async () => await source.GetDataAsync());
await Assert.ThrowsAsync<InvalidOperationException>(async () => await source.GetDataAsync());
}

[Test]
public void SkippedPixelDataSource_CopyToAsync_ThrowsInvalidOperationException()
public async Task SkippedPixelDataSource_CopyToAsync_ThrowsInvalidOperationException()
{
// Arrange
using var source = new SkippedPixelDataSource(0, 100);
using var destination = new MemoryStream();

// Act & Assert
Assert.ThrowsAsync<InvalidOperationException>(async () => await source.CopyToAsync(destination));
await Assert.ThrowsAsync<InvalidOperationException>(async () => await source.CopyToAsync(destination));
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions tests/SharpDicom.Tests/Integration/ImplicitVRSequenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ public async Task Parse_NestedSequences_ParentChainCorrect()
}

[Test]
public void Parse_NestedSequences_ExceedsMaxDepth_ThrowsException()
public async Task Parse_NestedSequences_ExceedsMaxDepth_ThrowsException()
{
var data = CreateDeeplyNestedSequenceFile(10);
using var stream = new MemoryStream(data);

var options = new DicomReaderOptions { MaxSequenceDepth = 4 };

Assert.ThrowsAsync<DicomDataException>(async () =>
await Assert.ThrowsAsync<DicomDataException>(async () =>
{
await DicomFile.OpenAsync(stream, options);
});
Expand Down
6 changes: 3 additions & 3 deletions tests/SharpDicom.Tests/Network/CEchoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public async Task AssociationReject_ClientThrowsException()
};

// Act & Assert
var ex = Assert.ThrowsAsync<DicomAssociationException>(
var ex = await Assert.ThrowsAsync<DicomAssociationException>(
async () => await client.ConnectAsync(contexts));

Assert.That(ex, Is.Not.Null);
Expand All @@ -281,7 +281,7 @@ public async Task CEchoAsync_BeforeConnect_ThrowsException()
await using var client = new DicomClient(clientOptions);

// Act & Assert
var ex = Assert.ThrowsAsync<DicomAssociationException>(
var ex = await Assert.ThrowsAsync<DicomAssociationException>(
async () => await client.CEchoAsync());

Assert.That(ex, Is.Not.Null);
Expand Down Expand Up @@ -326,7 +326,7 @@ public async Task CEchoAsync_VerificationNotNegotiated_ThrowsException()
await client.ConnectAsync(contexts);

// Act & Assert - C-ECHO should fail because Verification SOP Class not negotiated
var ex = Assert.ThrowsAsync<DicomAssociationException>(
var ex = await Assert.ThrowsAsync<DicomAssociationException>(
async () => await client.CEchoAsync());

Assert.That(ex, Is.Not.Null);
Expand Down
4 changes: 2 additions & 2 deletions tests/SharpDicom.Tests/Network/DicomClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public async Task ConnectAsync_AfterDispose_ThrowsObjectDisposedException()
new PresentationContext(1, DicomUID.Verification, TransferSyntax.ImplicitVRLittleEndian)
};

Assert.ThrowsAsync<ObjectDisposedException>(
await Assert.ThrowsAsync<ObjectDisposedException>(
async () => await client.ConnectAsync(contexts));
}

Expand All @@ -301,7 +301,7 @@ public async Task CEchoAsync_AfterDispose_ThrowsObjectDisposedException()
var client = new DicomClient(options);
await client.DisposeAsync();

Assert.ThrowsAsync<ObjectDisposedException>(
await Assert.ThrowsAsync<ObjectDisposedException>(
async () => await client.CEchoAsync());
}

Expand Down
18 changes: 9 additions & 9 deletions tests/SharpDicom.Tests/Network/Tls/TlsIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public async Task SelfSigned_AcceptedViaThumbprint()
}

[Test]
public void SelfSigned_RejectedWithoutThumbprint()
public async Task SelfSigned_RejectedWithoutThumbprint()
{
// Arrange
var serverCert = TlsCertificateHelper.CreateSelfSignedCertificate("localhost", TimeSpan.FromHours(1));
Expand All @@ -450,7 +450,7 @@ public void SelfSigned_RejectedWithoutThumbprint()

var server = new DicomServer(serverOptions);
server.Start();
Task.Delay(100).Wait();
await Task.Delay(100);

try
{
Expand All @@ -476,7 +476,7 @@ public void SelfSigned_RejectedWithoutThumbprint()
};

// Act & Assert
Assert.ThrowsAsync<TlsHandshakeException>(async () =>
await Assert.ThrowsAsync<TlsHandshakeException>(async () =>
{
await using (client)
{
Expand Down Expand Up @@ -561,7 +561,7 @@ public async Task CustomCA_AcceptedWithCAInTrustStore()

#if NET6_0_OR_GREATER
[Test]
public void MutualTls_MissingClientCert_Fails()
public async Task MutualTls_MissingClientCert_Fails()
{
// Arrange
using var serverCert = TlsCertificateHelper.CreateSelfSignedCertificate("localhost", TimeSpan.FromHours(1));
Expand All @@ -584,7 +584,7 @@ public void MutualTls_MissingClientCert_Fails()

var server = new DicomServer(serverOptions);
server.Start();
Task.Delay(100).Wait();
await Task.Delay(100);

try
{
Expand Down Expand Up @@ -612,7 +612,7 @@ public void MutualTls_MissingClientCert_Fails()

// Act & Assert - Server will close connection when client doesn't provide cert
// This can manifest as TlsHandshakeException or EndOfStreamException
Assert.CatchAsync<Exception>(async () =>
await Assert.CatchAsync<Exception>(async () =>
{
await using (client)
{
Expand All @@ -628,7 +628,7 @@ public void MutualTls_MissingClientCert_Fails()
}

[Test]
public void InvalidCert_Rejected()
public async Task InvalidCert_Rejected()
{
// Arrange - Use expired certificate
var expiredCert = TlsCertificateHelper.CreateExpiredCertificate("localhost");
Expand All @@ -649,7 +649,7 @@ public void InvalidCert_Rejected()

var server = new DicomServer(serverOptions);
server.Start();
Task.Delay(100).Wait();
await Task.Delay(100);

try
{
Expand All @@ -675,7 +675,7 @@ public void InvalidCert_Rejected()
};

// Act & Assert
var ex = Assert.ThrowsAsync<TlsHandshakeException>(async () =>
var ex = await Assert.ThrowsAsync<TlsHandshakeException>(async () =>
{
await using (client)
{
Expand Down
Loading