Ejemplo n.º 1
0
        /// <summary>
        /// Parses the HMRC vat returns PDF.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="info">The information.</param>
        /// <returns></returns>
        public Optional <VatReturnsPerBusiness> ParseHmrcVatReturnsPdf(string fileName, InfoAccumulator info)
        {
            PdfReader reader;

            try {
                reader = new FdfReader(fileName);
            } catch (Exception ex) {
                info.AddException(ex);
                return(null);
            }

            VatReturnsPerBusiness vatReturnsPerBusiness = new VatReturnsPerBusiness();

            HmrcBusiness    hmrcBusiness    = new HmrcBusiness();
            VatReturnRecord vatReturnRecord = new VatReturnRecord();

            vatReturnsPerBusiness.VatReturnRecord = vatReturnRecord;
            vatReturnsPerBusiness.Business        = hmrcBusiness;
            vatReturnsPerBusiness.Entries         = ParseVatReturnDetails(reader, info).Value;
            FillPeriodData(reader, vatReturnRecord, info);
            FillBusinessData(reader, vatReturnRecord, hmrcBusiness, info);

            if (!info.HasErrors)
            {
                return(vatReturnsPerBusiness);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public void NSBTest()
        {
            //initiates structure map container
            IContainer container = InitContainer(typeof(CustomerProcessor));

            InfoAccumulator acc = new InfoAccumulator();

            acc.AddError("error1");
            acc.AddError("error2");
            acc.AddException(new InvalidOperationException("bla bla bla"));

            string json = JsonConvert.SerializeObject(acc);

            var info = JsonConvert.DeserializeObject(json, typeof(InfoAccumulator));

            container = new Container(new EzBobServiceRegistry());


            Context context = new Context();

            Scenario.Define(context)
            .WithEndpoint <EzBobService>(b => {
                b.Given((bus, ctx) => {
                    bus.Send <CustomerSignupCommand>("EzBobService2", m => {
                        m.MessageId = Guid.NewGuid();
                    });
                    SubscriptionForIncomingBehavior.OnEndpointSubscribed(s => {
                        int kk = 0;
                    });

                    OutgoingSubscription.OnEndpointSubscribed(s => {
                        int kk = 0;
                    });
                })
                .When(ctx => ctx.IsServiceReady, bus => bus.Send <CustomerSignupCommand>("EzBobService2", m => {
                    m.MessageId = Guid.NewGuid();
                }));
            })
            .Done(IsDone)
            .Run();

//
//            Scenario.Define(ctx)
//                .WithEndpoint<EzBobService>(c => c.CustomConfig(cfg => cfg
//                    .UseContainer(CreateNsbTestContainer(container)) //based on initialized container, creates container suitable for NSB test framework
//                    )
//                    .Given((bus, context) => SubscriptionForIncomingBehavior.OnEndpointSubscribed(s => {
//                        int kk = 0;
//                    }))
//                    .When(context => context.IsMaySignup, bus => bus.Send("EzBobService2", new CustomerSignupCommand())))
//                .Done(IsDone)
//                .Run();
        }