Esempio n. 1
0
        public async Task Send_command_to_parse_ccr0402rdf_should_publish_105_RecordParsed_one_FileParsed_event([Frozen] FileParsedEvent expectedFileParsedEvent)
        {
            var blobId = await _blobStorage.AddFileAsync("ccr0402.rdf", Resource.ccr0402, "chemical/x-mdl-rdfile", BUCKET);

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

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

            //fixture.AllEvents.Count(e => e is FileParseFailed).ShouldBeEquivalentTo(0);

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

            //@event.ShouldBeEquivalentTo(expectedFileParsedEvent,
            //    options => options
            //        .Excluding(p => p.TimeStamp)
            //        .Excluding(p => p.Version)
            //    );
        }
Esempio n. 2
0
        public async Task Send_command_to_parse_all_rdfs_should_publish_RecordParsed_event_with_properties([Frozen] FileParsedEvent expectedEvent)
        {
            var resources = new List <byte[]>()
            {
                AllRdf.ccr0401,
                AllRdf.ccr0402,
                AllRdf.ccr0403,
                AllRdf.ccr0404,
                AllRdf.mos_sample50
            };

            foreach (var resourse in resources)
            {
                var blobId = await _blobStorage.AddFileAsync("someFile.rdf", resourse, "chemical/x-mdl-rdfile", BUCKET);

                //await fixture.Bus.Send(new ParseFile(expectedEvent.Id, expectedEvent.CorrelationId, expectedEvent.UserId, BUCKET, blobId));
            }
            //var allEvents = fixture.AllEvents.Where(e => e is RecordParsed).Select(e => e as RecordParsed).ToList();

            //allEvents.All(e => e.Fields != null).ShouldBeEquivalentTo(true);

            //@event.ShouldBeEquivalentTo(expectedEvent,
            //    options => options
            //        .Excluding(p => p.TimeStamp)
            //        .Excluding(p => p.Version)
            //    );
        }
Esempio n. 3
0
        public async Task Send_command_to_parse_valid_rdf_should_publish_75_RecordParsed_one_FileParsed_event([Frozen] FileParsedEvent expectedEvent)
        {
            try
            {
                await _harness.Start();

                var blobId = await _blobStorage.AddFileAsync("ccr0401.rdf", Resource.ccr0401, "chemical/x-mdl-rdfile", BUCKET);

                await _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 = _harness.Published.ToList();

                allEvents.Where(e => e.MessageType == typeof(RecordParsed)).Count().Should().Be(75);

                var parsed = allEvents.Select <FileParsed>().FirstOrDefault();
                parsed.Should().NotBeNull();
                parsed.Should().BeEquivalentTo(expectedEvent,
                                               options => options
                                               .Excluding(p => p.TimeStamp)
                                               .Excluding(p => p.Fields)
                                               .Excluding(p => p.TotalRecords)
                                               );
                parsed.TotalRecords.Should().Be(75);
                parsed.Fields.Count().Should().Be(6);
            }
            finally
            {
                await _harness.Stop();
            }
        }
Esempio n. 4
0
        public async Task Send_command_to_parse_all_rxns_should_publish_RecordParsed_event_with_properties([Frozen] FileParsedEvent expectedEvent)
        {
            var resources = new List <byte[]>()
            {
                AllRxn._10001,
                AllRxn._10002,
                AllRxn._10005,
                AllRxn._10006,
                AllRxn._10009,
                AllRxn._10010,
                AllRxn._10013,
                AllRxn._10014,
                AllRxn._10017,
                AllRxn._10018,
                AllRxn._10021,
                AllRxn._10022,
                AllRxn._10025,
                AllRxn._10026,
                AllRxn._10029,
                AllRxn._10030,
                AllRxn._10037,
                AllRxn._10038,
                AllRxn._10041,
                AllRxn._10042,
                AllRxn._10045,
                AllRxn._10046,
                AllRxn._10049,
                AllRxn._10050,
                AllRxn._10057,
                AllRxn._10058,
                AllRxn._10061,
                AllRxn._10062,
                AllRxn._10065,
                AllRxn._10066,
                AllRxn._10073,
                AllRxn._10074,
                AllRxn._10077,
                AllRxn._10078,
                AllRxn._10081,
                AllRxn._10082,
                AllRxn._10085,
                AllRxn._10086,
                AllRxn._10089,
                AllRxn._10090
            };

            foreach (var resourse in resources)
            {
                var blobId = await _blobStorage.AddFileAsync("someFile.rxn", resourse, "chemical/x-mdl-rdfile", BUCKET);

                //await fixture.Bus.Send(new ParseFile(expectedEvent.Id, expectedEvent.CorrelationId, expectedEvent.UserId, BUCKET, blobId));
            }
            //var allEvents = fixture.AllEvents.Where(e => e is RecordParsed).Select(e => e as RecordParsed).ToList();

            //allEvents.All(e => e.Fields != null).ShouldBeEquivalentTo(true);

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