diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiserTests.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiserTests.cs index 30bc000c0..a8c0bd275 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiserTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/Anonymisers/SmiCtpAnonymiserTests.cs @@ -5,6 +5,7 @@ using SmiServices.Microservices.DicomAnonymiser.Anonymisers; using SmiServices.UnitTests.TestCommon; using System.IO; +using System.IO.Abstractions; namespace SmiServices.IntegrationTests.Microservices.DicomAnonymiser.Anonymisers; @@ -33,9 +34,11 @@ public void Anonymise_HappyPath_IsOk() var srcPath = Path.Combine(tempDir, "in.dcm"); srcDcm.Save(srcPath); File.SetAttributes(srcPath, FileAttributes.ReadOnly); - var srcFile = new FileInfo(srcPath); + + var fileSystem = new FileSystem(); + var srcFile = fileSystem.FileInfo.New(srcPath); var destPath = Path.Combine(tempDir, "out.dcm"); - var destFile = new FileInfo(destPath); + var destFile = fileSystem.FileInfo.New(destPath); using var anonymiser = new SmiCtpAnonymiser(globals); diff --git a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs index 36822b768..ccfa59293 100644 --- a/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs +++ b/tests/SmiServices.IntegrationTests/Microservices/DicomAnonymiser/DicomAnonymiserHostTests.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.IO.Abstractions; using System.Linq; using System.Threading; @@ -83,8 +84,8 @@ public void Integration_HappyPath_MockAnonymiser() mockAnonymiser .Setup( x => x.Anonymise( - It.Is(x => x.Name == _fakeDicom), - It.Is(x => x.Name == Path.Combine(extractDirAbs.FullName, "foo-an.dcm")), + It.Is(x => x.Name == _fakeDicom), + It.Is(x => x.Name == Path.Combine(extractDirAbs.FullName, "foo-an.dcm")), It.IsAny(), out It.Ref.IsAny ) @@ -98,34 +99,34 @@ out It.Ref.IsAny List statusMessages = []; - using var tester = new MicroserviceTester( - globals.RabbitOptions!, - globals.DicomAnonymiserOptions.AnonFileConsumerOptions! - ); + using var tester = new MicroserviceTester( + globals.RabbitOptions!, + globals.DicomAnonymiserOptions.AnonFileConsumerOptions! + ); - tester.CreateExchange(statusExchange, successQueue, isSecondaryBinding: false, routingKey: "verify"); - tester.CreateExchange(statusExchange, failureQueue, isSecondaryBinding: true, routingKey: "noverify"); + tester.CreateExchange(statusExchange, successQueue, isSecondaryBinding: false, routingKey: "verify"); + tester.CreateExchange(statusExchange, failureQueue, isSecondaryBinding: true, routingKey: "noverify"); - tester.SendMessage(globals.DicomAnonymiserOptions.AnonFileConsumerOptions!, new MessageHeader(), testExtractFileMessage); + tester.SendMessage(globals.DicomAnonymiserOptions.AnonFileConsumerOptions!, new MessageHeader(), testExtractFileMessage); - var host = new DicomAnonymiserHost(globals, mockAnonymiser.Object); + var host = new DicomAnonymiserHost(globals, mockAnonymiser.Object); - host.Start(); + host.Start(); - var timeoutSecs = 10; + var timeoutSecs = 10; - while (statusMessages.Count == 0 && timeoutSecs > 0) - { - statusMessages.AddRange(tester.ConsumeMessages(successQueue).Select(x => x.Item2)); - statusMessages.AddRange(tester.ConsumeMessages(failureQueue).Select(x => x.Item2)); + while (statusMessages.Count == 0 && timeoutSecs > 0) + { + statusMessages.AddRange(tester.ConsumeMessages(successQueue).Select(x => x.Item2)); + statusMessages.AddRange(tester.ConsumeMessages(failureQueue).Select(x => x.Item2)); - --timeoutSecs; - if (statusMessages.Count == 0) - Thread.Sleep(TimeSpan.FromSeconds(1)); - } + --timeoutSecs; + if (statusMessages.Count == 0) + Thread.Sleep(TimeSpan.FromSeconds(1)); + } - host.Stop("Test end"); - tester.Dispose(); + host.Stop("Test end"); + tester.Dispose(); var statusMessage = statusMessages.Single(); Assert.Multiple(() =>