Esempio n. 1
0
        public async Task Send_command_to_parse_empty_rdf_should_publish_one_FileParseFailed_event([Frozen] FileParseFailedEvent expectedEvent)
        {
            var blobId = await _blobStorage.AddFileAsync("empty.rdf", Resource.emptyrdf, "chemical/x-mdl-rdfile", BUCKET);

            //await fixture.Bus.Send(new ParseFile(expectedEvent.Id, expectedEvent.CorrelationId, expectedEvent.UserId, BUCKET, blobId));

            //fixture.AllEvents
            //    .Should().ContainItemsAssignableTo<FileParseFailed>()
            //    .And.ContainSingle();

            //var @event = fixture.AllEvents.First();

            //@event.ShouldBeEquivalentTo(expectedEvent,
            //    options => options
            //        .Excluding(p => p.TimeStamp)
            //        .Excluding(p => p.Version)
            //    );
        }
Esempio n. 2
0
        public async Task Send_command_to_parse_nonexistent_file_should_publish_one_FileParseFailed_event([Frozen] FileParseFailedEvent expectedEvent)
        {
            try
            {
                await _fixture.Harness.Start();

                var blobId = Guid.NewGuid();

                await _fixture.Harness.InputQueueSendEndpoint.Send <ParseFile>(new
                {
                    expectedEvent.Id,
                    Bucket = BUCKET,
                    BlobId = blobId,
                    expectedEvent.CorrelationId,
                    expectedEvent.UserId
                });

                var res = _consumer.Consumed.Select <ParseFile>().Any();
                res.Should().BeTrue();

                var allEvents = _fixture.Harness.Published.ToList();

                var failed = allEvents.Select <FileParseFailed>().FirstOrDefault();
                failed.Should().NotBeNull();
                failed.Should().BeEquivalentTo(new
                {
                    expectedEvent.Id,
                    expectedEvent.UserId,
                    expectedEvent.CorrelationId
                }
                                               //options => options.Excluding(p => p.TimeStamp)
                                               //.Excluding(p => p.RecordsProcessed)
                                               //.Excluding(p => p.Message)
                                               );
                failed.Message.Should().StartWith($"Cannot parse reaction file from bucket {BUCKET} with Id {expectedEvent.Id}. Error:");
            }
            finally
            {
                await _fixture.Harness.Stop();
            }
        }
Esempio n. 3
0
        public async Task Send_command_to_parse_trash_rdf_should_publish_one_RecordParseFailed_one_FileParseFailed_event([Frozen] FileParseFailedEvent expectedEvent)
        {
            var blobId = await _blobStorage.AddFileAsync("non_rdf.rdf", Resource.non_rdf, "chemical/x-mdl-rdfile", BUCKET);

            //await fixture.Bus.Send(new ParseFile(expectedEvent.Id, expectedEvent.CorrelationId, expectedEvent.UserId, BUCKET, blobId));

            //fixture.AllEvents.Count(e => e is RecordParseFailed).ShouldBeEquivalentTo(1);
            //fixture.AllEvents.Count(e => e is FileParsed).ShouldBeEquivalentTo(1);

            //var @event = fixture.AllEvents.Last();

            //@event.ShouldBeEquivalentTo(expectedEvent,
            //    options => options
            //        .Excluding(p => p.TimeStamp)
            //        .Excluding(p => p.Version)
            //    );
        }