public void can_create_interchange_control_with_810()
 {
     InvoicedOrderMessage order = GetOrder();
     _sut = _resolver.ResolveFrom(order);
     var subscr = ServiceLocator.Current.GetInstance<Subscriber<InvoicedOrderMessage>>();
     subscr.Consume(order);
 }
Example #2
0
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();


            _sut = ServiceLocator.Current.GetInstance <ICreateEdiContentFrom <FinishedAndRawInventoryCountedList> >();
        }
Example #3
0
        public void Consume(T message)
        {
            try
            {
                ICreateEdiContentFrom <T> ediContentCreator = _businessPartnerResolver.ResolveFrom(message);

                if (ediContentCreator == null)
                {
                    throw new InvalidOperationException("No matching document creator was found for business partner "
                                                        + message.BusinessPartnerCode + ", Document ID " +
                                                        message.DocumentId);
                }

                EDITransmissionPackage package = _createEdiDocumentFrom.CreateDocumentWith(ediContentCreator, message);

                checkForProblems(message, package);

                _ediDocumentSaver.Save(package);
                //_ediDocumentSaver.SaveAsXml(package);

                Logger.Info(this, "Document Saved: " + package.GetInterchangeControl().Value);

                _postConsumeAction.Execute(message);
            }
            catch (Exception ex)
            {
                Logger.Error(this, "Error processing message", ex);
                throw;
            }
        }
 public FedexOrderAckService(
                             ICreateEdiContentFrom<CreateOrderMessage> builder,
                             IFileCreationService fileSvc)
 {
     _builder = builder;
     _fileSvc = fileSvc;
 }
 public void can_create_855()
 {
     OrderRequestReceivedMessage orderRequestReceived = GetOrder();
     _sut = _resolver.ResolveFrom(orderRequestReceived);
     EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(orderRequestReceived);
     Console.WriteLine(ediStr);
 }
 public void can_create_interchange_control_with_855()
 {
     OrderRequestReceivedMessage orderRequestReceived = GetOrder();
     _sut = _resolver.ResolveFrom(orderRequestReceived);
     var subscr = ServiceLocator.Current.GetInstance<Subscriber<OrderRequestReceivedMessage>>();
     subscr.Consume(orderRequestReceived);
 }
Example #7
0
 public FedexOrderAckService(
     ICreateEdiContentFrom <CreateOrderMessage> builder,
     IFileCreationService fileSvc)
 {
     _builder = builder;
     _fileSvc = fileSvc;
 }
 public void can_create_810()
 {
     InvoicedOrderMessage order = GetOrder();
     _sut = _resolver.ResolveFrom(order);
     EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);
     Console.WriteLine(ediStr.Value);
 }
Example #9
0
        public void can_create_interchange_control_with_855()
        {
            OrderRequestReceivedMessage orderRequestReceived = GetOrder();

            _sut = _resolver.ResolveFrom(orderRequestReceived);
            var subscr = ServiceLocator.Current.GetInstance <Subscriber <OrderRequestReceivedMessage> >();

            subscr.Consume(orderRequestReceived);
        }
Example #10
0
        public void can_create_855()
        {
            OrderRequestReceivedMessage orderRequestReceived = GetOrder();

            _sut = _resolver.ResolveFrom(orderRequestReceived);
            EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(orderRequestReceived);

            Console.WriteLine(ediStr);
        }
Example #11
0
        public void will_throw_exception_if_no_lines()
        {
            var order = new InvoicedOrderMessage {
                Customer = new Customer(), ControlNumber = "23443", BusinessPartnerCode = BusinessPartner.Flextronics.Code, BusinessPartnerNumber = BusinessPartner.Flextronics.Number
            };

            _sut = _resolver.ResolveFrom(order);
            _sut.BuildFromMessage(order);
        }
Example #12
0
        public void can_create_810()
        {
            InvoicedOrderMessage order = GetOrder();

            _sut = _resolver.ResolveFrom(order);
            EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);

            Console.WriteLine(ediStr.Value);
        }
Example #13
0
        public void can_create_interchange_control_with_810()
        {
            InvoicedOrderMessage order = GetOrder();

            _sut = _resolver.ResolveFrom(order);
            var subscr = ServiceLocator.Current.GetInstance <Subscriber <InvoicedOrderMessage> >();

            subscr.Consume(order);
        }
Example #14
0
        public void will_throw_exception_if_no_lines()
        {
            var order = new InvoicedOrderMessage {
                Customer = new Customer(), ControlNumber = "23443", BusinessPartnerCode = BusinessPartner.MicroCenter.Code, DocumentId = 810
            };

            _sut = _resolver.ResolveFrom(order);
            _sut.BuildFromMessage(order);
        }
Example #15
0
        public void will_throw_exception_if_no_lines()
        {
            var order = new OrderRequestReceivedMessage()
            {
                BusinessPartnerCode = BusinessPartner.Initech.Code, BusinessPartnerNumber = BusinessPartner.Initech.Number
            };

            _sut = _resolver.ResolveFrom(order);
            _sut.BuildFromMessage(order);
        }
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();

            ObjectFactory.Configure(x =>
                                        {
                                            x.For<IServiceBus>().Use<FakeServiceBus>();
                                        });

            var lst = ServiceLocator.Current.GetAllInstances<ICreateEdiContentFrom<OrderRequestReceivedMessage>>();
            _sut = lst.Find(c => c.CanProcess(GetOrder()));
        }
Example #17
0
        public void can_resolve_correct_business_partner_document_creator()
        {
            var msg = new OrderHasBeenShippedMessage
            {
                BusinessPartnerCode   = BusinessPartner.Initech.Code,
                BusinessPartnerNumber = BusinessPartner.Initech.Number
            };
            ICreateEdiContentFrom <OrderHasBeenShippedMessage> creator = _sut.ResolveFrom(msg);

            Assert.That(creator, Is.TypeOf(typeof(Initech856Creator)),
                        "Type is actually " + creator.GetType());
        }
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();
            ObjectFactory.Configure(x =>
                                        {
                                            x.For<IServiceBus>().Use<FakeServiceBus>();
                                        });

            var lst = ServiceLocator.Current.GetAllInstances<ICreateEdiContentFrom<InvoicedOrderMessage>>();
            _sut = lst.Find(p => p.CanProcess(GetOrder()));
            var docRepo = ServiceLocator.Current.GetInstance<IIncomingDocumentsRepository>();
            docRepo.Save(get_save_info());
        }
 public void can_create_810()
 {
     //Arrange
     InvoicedOrderMessage order = GetOrder();
     //Act
     _sut = _resolver.ResolveFrom(order);
     EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);
     var arr = ediStr.Value.Split("\n".ToCharArray());
     //Assert
     arr[1].ShouldEqual("BIG~20110610~461191~20110601~4110213145~~~DI");
     arr[2].ShouldEqual("REF~IA~25097");
     arr[arr.Length - 3].ShouldEqual("CTT~2");
 }
Example #20
0
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();

            ObjectFactory.Configure(x =>
            {
                x.For <IServiceBus>().Use <FakeServiceBus>();
            });


            var lst = ServiceLocator.Current.GetAllInstances <ICreateEdiContentFrom <OrderRequestReceivedMessage> >();

            _sut = lst.Find(c => c.CanProcess(GetOrder()));
        }
Example #21
0
        public void can_create_810()
        {
            //Arrange
            InvoicedOrderMessage order = GetOrder();

            //Act
            _sut = _resolver.ResolveFrom(order);
            EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);
            var arr = ediStr.Value.Split("\n".ToCharArray());

            //Assert
            arr[1].ShouldEqual("BIG~20110610~461191~20110601~4110213145~~~DI");
            arr[2].ShouldEqual("REF~IA~25097");
            arr[arr.Length - 3].ShouldEqual("CTT~2");
        }
Example #22
0
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();

            ObjectFactory.Configure(x =>
            {
                x.For <IMessagePublisher>().Use <FakeMessagePublisher>();
            });

            var lst = ServiceLocator.Current.GetAllInstances <ICreateEdiContentFrom <OrderHasBeenShippedMessage> >();

            _sut = lst.Find(c => c.CanProcess(GetOrder()));
            var docRepo = ServiceLocator.Current.GetInstance <IIncomingDocumentsRepository>();

            docRepo.Save(get_save_info());
        }
Example #23
0
        public EDITransmissionPackage CreateDocumentWith(ICreateEdiContentFrom <T> creator, T message)
        {
            var ediXmlInterchangeControl = new EDIXmlInterchangeControl(creator.SegmentFactory);

            EDIXmlTransactionSet ediTransactionSet = creator.BuildFromMessage(message);

            var isaControlNumber = ediTransactionSet.ISA.ControlNumber;
            var functionalID     = ediTransactionSet.ISA.GroupID;

            ediXmlInterchangeControl.SetHeader(isaControlNumber, functionalID, _configuration.TestMode);

            ediXmlInterchangeControl.AddContent(ediTransactionSet);

            ediXmlInterchangeControl.SetFooter(isaControlNumber, 1);

            return(new EDITransmissionPackage(ediXmlInterchangeControl, creator.GetBusinessPartner()));
        }
        public void can_create_856()
        {
            //Arrange
            OrderHasBeenShippedMessage order = GetOrder();

            //Act
            _sut = _resolver.ResolveFrom(order);
            EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);

            var arr = ediStr.Value.Split("\n".ToCharArray());
            //Assert
            arr[1].Substring(0,17).ShouldEqual("BSN~00~0005456~20");

            Assert.That(ediStr.Value, Text.Contains("~"));
            Assert.That(ediStr.Value, Text.Contains("\n"));

            Console.WriteLine(ediStr.Value);
        }
Example #25
0
        public void can_create_856()
        {
            //Arrange
            OrderHasBeenShippedMessage order = GetOrder();

            //Act
            _sut = _resolver.ResolveFrom(order);
            EDIXmlTransactionSet ediStr = _sut.BuildFromMessage(order);

            var arr = ediStr.Value.Split("\n".ToCharArray());

            //Assert
            arr[1].Substring(0, 17).ShouldEqual("BSN~00~0005456~20");


            Assert.That(ediStr.Value, Text.Contains("~"));
            Assert.That(ediStr.Value, Text.Contains("\n"));

            Console.WriteLine(ediStr.Value);
        }
 public void will_throw_exception_if_no_lines()
 {
     var order = new OrderRequestReceivedMessage(){BusinessPartnerCode = BusinessPartner.Initech.Code,BusinessPartnerNumber = BusinessPartner .Initech .Number};
     _sut = _resolver.ResolveFrom(order);
     _sut.BuildFromMessage(order);
 }
 public void will_throw_exception_if_no_lines()
 {
     var order = new InvoicedOrderMessage { Customer = new Customer(), ControlNumber = "23443", BusinessPartnerCode = BusinessPartner .Flextronics .Code, BusinessPartnerNumber = BusinessPartner .Flextronics .Number };
     _sut = _resolver.ResolveFrom(order);
     _sut.BuildFromMessage(order);
 }
        public void SetUp()
        {
            StructureMapBootstrapper.Execute();

            _sut = ServiceLocator.Current.GetInstance<ICreateEdiContentFrom<FinishedAndRawInventoryCountedList>>();
        }
 public void will_throw_exception_if_no_lines()
 {
     var order = new InvoicedOrderMessage { Customer = new Customer(), ControlNumber = "23443", BusinessPartnerCode = BusinessPartner.MicroCenter.Code, DocumentId = 810 };
     _sut = _resolver.ResolveFrom(order);
     _sut.BuildFromMessage(order);
 }