Beispiel #1
0
 public static void WaitWhileProcessingFinished(this MicroscopyMetadataTestHarness harness, Guid correlationId)
 {
     if (!harness.Received.Select <CorrelatedBy <Guid> >(m => m.Context.Message.CorrelationId == correlationId).Any())
     {
         throw new TimeoutException();
     }
 }
Beispiel #2
0
 public InvalidMicroscopyFileTest(MicroscopyMetadataTestHarness harness, ITestOutputHelper output, InvalidMicroscopyFileTestFixture initFixture) : base(harness, output)
 {
     Id            = initFixture.Id;
     CorrelationId = initFixture.CorrelationId;
     Bucket        = initFixture.Bucket;
     UserId        = initFixture.UserId;
 }
Beispiel #3
0
 public static async Task PublishExtractMetadataCommand(this MicroscopyMetadataTestHarness harness, Guid id, Guid blobId, string bucket, Guid userId, Guid correlationId)
 {
     await harness.BusControl.Publish <ExtractMicroscopyMetadata>(new
     {
         Id            = id,
         UserId        = userId,
         BlobId        = blobId,
         Bucket        = bucket,
         CorrelationId = correlationId
     });
 }
        public MicroscopyMetadataTest(MicroscopyMetadataTestHarness fixture, ITestOutputHelper output = null)
        {
            Harness = fixture;

            if (output != null)
            {
                Log.Logger = new LoggerConfiguration()
                             .MinimumLevel.Debug()
                             .WriteTo
                             .TestOutput(output, LogEventLevel.Verbose)
                             .CreateLogger()
                             .ForContext <MicroscopyMetadataTest>();
            }
        }
Beispiel #5
0
        public static async Task ExtractMicroscopyMetadata(this MicroscopyMetadataTestHarness harness, Guid id, Guid blobId, string bucket, Guid userId, Guid correlationId)
        {
            await harness.PublishExtractMetadataCommand(id, blobId, bucket, userId, correlationId);

            harness.WaitWhileProcessingFinished(correlationId);
        }
Beispiel #6
0
        public static async Task <Guid> UploadFile(this MicroscopyMetadataTestHarness harness, string bucket, string path)
        {
            var source = new FileStream(path, FileMode.Open, FileAccess.Read);

            return(await harness.BlobStorage.AddFileAsync(Path.GetFileName(path), source, "application/octet-stream", bucket));
        }
Beispiel #7
0
 public static async Task <Guid> UploadResource(this MicroscopyMetadataTestHarness harness, string bucket, string fileName)
 {
     return(await UploadFile(harness, bucket, Path.Combine(Directory.GetCurrentDirectory(), "Resources", fileName)));
 }
Beispiel #8
0
 public InvalidMicroscopyFileTestFixture(MicroscopyMetadataTestHarness harness)
 {
     Bucket = UserId.ToString();
     BlobId = Guid.NewGuid();
     harness.ExtractMicroscopyMetadata(Id, BlobId, Bucket, UserId, CorrelationId).Wait();
 }
 public MicroscopyFileTestFixture(MicroscopyMetadataTestHarness harness)
 {
     Bucket = UserId.ToString();
     BlobId = harness.UploadResource(Bucket, "Nikon_BF007.nd2").Result;
     harness.ExtractMicroscopyMetadata(Id, BlobId, Bucket, UserId, CorrelationId).Wait();
 }