示例#1
0
        public async Task Send_command_to_parse_odp_should_publish_one_ConvertedToPdf_event([Frozen] ConvertedToPdfEvent expectedEvent)
        {
            try
            {
                await _fixture.Harness.Start();

                var blobId = await _fixture.BlobStorage.AddFileAsync("Soton_April_2013odp.odp", Resource.Soton_April_2013odp, "application/vnd.oasis.opendocument.presentation", BUCKET);

                await _fixture.Harness.Bus.Publish <ConvertToPdf>(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    BlobId        = blobId,
                    CorrelationId = expectedEvent.CorrelationId,
                    UserId        = expectedEvent.UserId
                });

                await _fixture.Harness.Published.Any <ConvertedToPdf>(TimeSpan.FromSeconds(30));

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

                var converted = allEvents.Select <ConvertedToPdf>().SingleOrDefault();
                converted.Should().NotBeNull();
                converted.ShouldBeEquivalentTo(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    UserId        = expectedEvent.UserId,
                    CorrelationId = expectedEvent.CorrelationId
                },
                                               options => options.ExcludingMissingMembers()
                                               );
            }
            finally
            {
                await _fixture.Harness.Stop();
            }
        }
示例#2
0
        public async Task Send_command_to_parse_docx_should_publish_one_ConvertedToPdf_event([Frozen] ConvertedToPdfEvent expectedEvent)
        {
            try
            {
                await _fixture.Harness.Start();

                var blobId = await _fixture.BlobStorage.AddFileAsync("Hexahedron_kk_kc_kk_rm2_kk_docx.docx", Resource.Hexahedron_kk_kc_kk_rm2_kk_docx, "application/msword", BUCKET);

                await _fixture.Harness.Bus.Publish <ConvertToPdf>(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    BlobId        = blobId,
                    CorrelationId = expectedEvent.CorrelationId,
                    UserId        = expectedEvent.UserId
                });

                await _fixture.Harness.Published.Any <ConvertedToPdf>();

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

                var converted = allEvents.Select <ConvertedToPdf>().SingleOrDefault();
                converted.Should().NotBeNull();
                converted.ShouldBeEquivalentTo(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    UserId        = expectedEvent.UserId,
                    CorrelationId = expectedEvent.CorrelationId
                },
                                               options => options.ExcludingMissingMembers()
                                               );
            }
            finally
            {
                await _fixture.Harness.Stop();
            }
        }
示例#3
0
        public async Task Send_command_to_parse_xlsx_should_publish_one_ConvertedToPdf_event([Frozen] ConvertedToPdfEvent expectedEvent)
        {
            try
            {
                await _fixture.Harness.Start();

                var blobId = await _fixture.BlobStorage.AddFileAsync("key_journal_set_xlsx.xlsx", Resource.key_journal_set_xlsx, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", BUCKET);

                await _fixture.Harness.Bus.Publish <ConvertToPdf>(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    BlobId        = blobId,
                    CorrelationId = expectedEvent.CorrelationId,
                    UserId        = expectedEvent.UserId
                });

                await _fixture.Harness.Published.Any <ConvertedToPdf>();

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

                var converted = allEvents.Select <ConvertedToPdf>().SingleOrDefault();
                converted.Should().NotBeNull();
                converted.ShouldBeEquivalentTo(new
                {
                    Id            = expectedEvent.Id,
                    Bucket        = BUCKET,
                    UserId        = expectedEvent.UserId,
                    CorrelationId = expectedEvent.CorrelationId
                },
                                               options => options.ExcludingMissingMembers()
                                               );
            }
            finally
            {
                await _fixture.Harness.Stop();
            }
        }