Skip to content

Commit fb5ae6a

Browse files
committed
gh-165 Fix unit test & rebase conflicts
Signed-off-by: Victor Chang <[email protected]>
1 parent 5c6ba1d commit fb5ae6a

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

src/InformaticsGateway/Services/Http/DestinationAeTitleController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ public async Task<ActionResult<string>> Create(DestinationApplicationEntity item
161161
}
162162
catch (ObjectExistsException ex)
163163
{
164-
return Problem(title: "DICOM destination already exists", statusCode: (int)System.Net.HttpStatusCode.Conflict, detail: ex.Message);
164+
return Problem(title: "DICOM destination already exists", statusCode: StatusCodes.Status409Conflict, detail: ex.Message);
165165
}
166166
catch (ConfigurationException ex)
167167
{
168-
return Problem(title: "Validation error", statusCode: (int)System.Net.HttpStatusCode.BadRequest, detail: ex.Message);
168+
return Problem(title: "Validation error", statusCode: StatusCodes.Status400BadRequest, detail: ex.Message);
169169
}
170170
catch (Exception ex)
171171
{

src/InformaticsGateway/Test/Services/Export/ScuExportServiceTest.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
namespace Monai.Deploy.InformaticsGateway.Test.Services.Export
4343
{
44-
public class ScuExportServiceTest : IClassFixture<DicomScpFixture>
44+
public class ScuExportServiceTest : IClassFixture<DicomScpFixture>, IDisposable
4545
{
4646
private readonly Mock<IStorageService> _storageService;
4747
private readonly Mock<IMessageBrokerSubscriberService> _messageSubscriberService;
@@ -56,6 +56,7 @@ public class ScuExportServiceTest : IClassFixture<DicomScpFixture>
5656
private readonly CancellationTokenSource _cancellationTokenSource;
5757
private readonly DicomScpFixture _dicomScp;
5858
private readonly int _port = 11104;
59+
private bool _disposedValue;
5960

6061
public ScuExportServiceTest(DicomScpFixture dicomScp)
6162
{
@@ -521,5 +522,25 @@ private async Task StopAndVerify(ScuExportService service)
521522
_logger.VerifyLogging($"{service.ServiceName} is stopping.", LogLevel.Information, Times.Once());
522523
Thread.Sleep(500);
523524
}
525+
526+
protected virtual void Dispose(bool disposing)
527+
{
528+
if (!_disposedValue)
529+
{
530+
if (disposing)
531+
{
532+
_dicomScp.Dispose();
533+
}
534+
535+
_disposedValue = true;
536+
}
537+
}
538+
539+
public void Dispose()
540+
{
541+
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
542+
Dispose(disposing: true);
543+
GC.SuppressFinalize(this);
544+
}
524545
}
525546
}

src/InformaticsGateway/Test/Services/Scu/ScuServiceTest.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030

3131
namespace Monai.Deploy.InformaticsGateway.Test.Services.Scu
3232
{
33-
public class ScuServiceTest : IClassFixture<DicomScpFixture>
33+
public class ScuServiceTest : IClassFixture<DicomScpFixture>, IDisposable
3434
{
3535
private readonly DicomScpFixture _dicomScp;
36-
private readonly int _port = 11104;
36+
private readonly int _port = 11105;
3737

3838
private readonly Mock<IServiceScopeFactory> _serviceScopeFactory;
3939
private readonly Mock<ILogger<ScuService>> _logger;
@@ -44,6 +44,7 @@ public class ScuServiceTest : IClassFixture<DicomScpFixture>
4444
private readonly CancellationTokenSource _cancellationTokenSource;
4545
private readonly ServiceProvider _serviceProvider;
4646
private readonly Mock<IServiceScope> _serviceScope;
47+
private bool _disposedValue;
4748

4849
public ScuServiceTest(DicomScpFixture dicomScp)
4950
{
@@ -154,5 +155,25 @@ public async Task GivenACEchoRequest_WhenRemoteServerIsUnreachable_ReturnStatusA
154155
Assert.Equal(ResponseError.Unhandled, response.Error);
155156
Assert.StartsWith("One or more error", response.Message);
156157
}
158+
159+
protected virtual void Dispose(bool disposing)
160+
{
161+
if (!_disposedValue)
162+
{
163+
if (disposing)
164+
{
165+
_dicomScp.Dispose();
166+
}
167+
168+
_disposedValue = true;
169+
}
170+
}
171+
172+
public void Dispose()
173+
{
174+
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
175+
Dispose(disposing: true);
176+
GC.SuppressFinalize(this);
177+
}
157178
}
158179
}

0 commit comments

Comments
 (0)