private static InvoicedOrderMessage GetFedexOrder()
 {
     var order = new InvoicedOrderMessage
     {
         Customer =
             new Customer { CustomerIDs = new CustomerAliases() { LegacyCustomerID = BusinessPartner.FedEx.Code }, CustomerName = "Fedex" },
         CustomerPO = "SRC009680",
         Location = "Austin",
         OrderType = "O",
         BusinessPartnerCode = BusinessPartner.FedEx.Code,
         BusinessPartnerNumber = BusinessPartner.FedEx.Number,
         ControlNumber = "23443",
         InvoiceNumber = "2345",
         InvoiceDate = "6/10/2009".CastToDateTime(),
         SalesTax = (decimal)2.50
     };
     order.Add(new InvoicedOrderLine
     {
         ItemID = "FIN23430I0",
         LineNumber = 1,
         CustomerPartNumber = "94001",
         ItemDescription = "Box, 10X6X6",
         Price = (decimal)1.1,
         Quantity = 120,
         CustomerPO = "997439"
     });
     order.Add(new InvoicedOrderLine
     {
         ItemID = "FIN66430I0",
         LineNumber = 2,
         CustomerPartNumber = "94001",
         ItemDescription = "Box 12X6X6",
         Price = (decimal)1.78,
         Quantity = 190,
         CustomerPO = "997439"
     });
     order.AddAddress(new Address
     {
         Address1 = "2343 Mockingbird Ln.",
         AddressCode = new AddressCode { CustomerCode = "adfd" },
         AddressName = "Fedex",
         AddressType = AddressTypeConstants.ShipTo,
         City = "Boise",
         State = "ID"
     });
     return order;
 }
        public void can_notify_failure_of_InvoicedOrderMessage()
        {
            var message = new InvoicedOrderMessage {BusinessPartnerCode = "WWT"};
            var exception = new Exception("Test Exception");
            var fault = new Fault<InvoicedOrderMessage>(message, exception);

            _sut.NotifyFailureOf(fault);

            _notificationSender.Verify(x => x.SendNotification(
                                                It.IsAny<string>(),
                                                It.Is<IList<EmailAddress>>(
                                                    a =>
                                                    a[0].Address ==
                                                    EmailAddressConstants.InformationtechnologygroupEmailAddress &&
                                                    a[1].Address == EmailAddressConstants.AccountsReceivableEmailAddress),
                                                It.Is<string>(body => body.Contains(message.ToString()) &&
                                                                      body.Contains(exception.ToString()))));
        }
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new InvoicedOrderMessage();
            var ediContentCreator = new Mock<ICreateEdiContentFrom<InvoicedOrderMessage>>();
            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var package = new EDITransmissionPackage(new EDIXmlInterchangeControl(_seg), BusinessPartner.FedEx);
            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
                .Returns(package);
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);
            _ediDocumentSaver.Setup(x => x.Save(package));

            //ACT
            _sut.Consume(message);

            //ASSERT
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
        private InvoicedOrderMessage CreateFlex_InvoicedOrderMessage()
        {
            var order = new InvoicedOrderMessage
                            {
                                Customer =
                                    new Customer
                                    {
                                        CustomerName = "Initech",
                                        CustomerIDs = new CustomerAliases()
                                                                                                    {
                                                                                                        LegacyCustomerID = BusinessPartner.Initech.Code
                                                                                                    } },

                                CustomerPO = "997439",
                                Location = "Austin",
                                OrderType = "O",
                                BusinessPartnerCode = BusinessPartner.Initech.Code,
                                BusinessPartnerNumber = BusinessPartner.Initech.Number,
                                ControlNumber = "70001",
                                InvoiceNumber = "2345",
                                InvoiceDate = "6/10/2009".CastToDateTime(),
                                PODate = "6/1/2009".CastToDateTime()
                            };
            order.Add(new InvoicedOrderLine
                          {
                              ItemID = "FIN23430I0",
                              LineNumber = 1,
                              CustomerPartNumber = "WR545",
                              ItemDescription = "Box, 10X6X6",
                              Price = (decimal) 1.1,
                              Quantity = 120,
                              CustomerPO = "997439"
                          });
            order.Add(new InvoicedOrderLine
                          {
                              ItemID = "FIN66430I0",
                              LineNumber = 2,
                              CustomerPartNumber = "XR545",
                              ItemDescription = "Box 12X6X6",
                              Price = (decimal) 1.78,
                              Quantity = 190,
                              CustomerPO = "997439"
                          });
            order.AddAddress(new Address
                                 {
                                     Address1 = "2343 Mockingbird Ln.",
                                     AddressCode = new AddressCode {CustomerCode = "0000001"} ,
                                     AddressName = "Flex",
                                     AddressType = AddressTypeConstants.ShipTo,
                                     City = "Boise",
                                     State = "ID"
                                 });
            return order;
        }
        private static InvoicedOrderMessage GetOrder()
        {
            var order = new InvoicedOrderMessage
                            {
                                Customer =
                                    new Customer { CustomerIDs = new CustomerAliases() { LegacyCustomerID = BusinessPartner.MicroCenter.Code }, CustomerName = "MicroCenter" },
                                CustomerPO = "4110213145",
                                Location = "Austin",
                                OrderType = "O",
                                BusinessPartnerCode = BusinessPartner.MicroCenter.Code,
                                BusinessPartnerNumber = BusinessPartner.MicroCenter.Number,
                                ControlNumber = "23444",
                                InvoiceNumber = "461191",
                                InvoiceDate = "6/10/2011".CastToDateTime(),
                                PODate = "6/1/2011".CastToDateTime(),
                                Notes = "101435"
                            };
            order.Add(new InvoicedOrderLine
                          {
                              ItemID = "FIN23430I0",
                              LineNumber = 1,
                              CustomerPartNumber = "14000181",
                              ItemDescription = "Box, 10X6X6",
                              Price = (decimal) 419,
                              Quantity = 250,
                              CustomerPO = "4110213145"
                          });
            order.Add(new InvoicedOrderLine()
            {
                ItemID = "FIN23430SS0",
                LineNumber = 2,
                CustomerPartNumber = "14000182",
                ItemDescription = "Box, 10X8X6",
                Price = (decimal)119,
                Quantity = 50,
                CustomerPO = "4110213145"

                          });
            order.AddAddress(new Address
                                 {
                                     Address1 = "2343 Mockingbird Ln.",
                                     AddressCode =  new AddressCode { CustomerCode = "0000001"},
                                     AddressName = "MicroCenter",
                                     AddressType = AddressTypeConstants.ShipTo,
                                     City = "Boise",
                                     State = "ID"
                                 });
            order.AddAddress(new Address
            {
                Address1 = "1111 1st St.",
                AddressCode = new AddressCode { CustomerCode = "0000001" },
                AddressName = "AFP",
                AddressType = AddressTypeConstants.ShipFrom,
                City = "Columbus",
                State = "OH"
            });
            return order;
        }
 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);
 }
        private static InvoicedOrderMessage GetOrder()
        {
            var order = new InvoicedOrderMessage
                            {
                                Customer =
                                    new Customer { CustomerIDs = new CustomerAliases() { LegacyCustomerID = BusinessPartner.Initech.Code }, CustomerName = "Initech" },
                                CustomerPO = "AFP009680",
                                Location = "Austin",
                                OrderType = "O",
                                BusinessPartnerCode = BusinessPartner.Initech.Code,
                                BusinessPartnerNumber = BusinessPartner.Initech.Number,
                                ControlNumber = "23443",
                                InvoiceNumber = "2345",
                                InvoiceDate = "6/10/2009".CastToDateTime(),
                                SalesTax = 0m
                            };
            order.Add(new InvoicedOrderLine
                          {
                              ItemID = "FIN23430I0",
                              LineNumber = 1,
                              CustomerPartNumber = "94001",
                              ItemDescription = "Box, 10X6X6",
                              Price = (decimal) 1.1,
                              Quantity = 120,
                              CustomerPO = "997439"
                          });
            order.Add(new InvoicedOrderLine
                          {
                              ItemID = "FIN66430I0",
                              LineNumber = 2,
                              CustomerPartNumber = "94001",
                              ItemDescription = "Box 12X6X6",
                              Price = (decimal) 1.78,
                              Quantity = 190,
                              CustomerPO = "997439"
                          });
            order.AddAddress(new Address
                                 {
                                     Address1 = "2343 Mockingbird Ln.",
                                     AddressCode = new AddressCode { CustomerCode = "adfd" },
                                     AddressName = "Initech",
                                     AddressType = AddressTypeConstants.ShipTo,
                                     City = "Boise",
                                     State = "ID"
                                 });

            order.AddAddress(new Address
                                 {
                                     Address1 = "1253 Heil Quaker Blvd.",
                                     AddressCode = new AddressCode { CustomerCode = "adfd" },
                                     AddressName = "Austin Foam Plastics",
                                     AddressType = AddressTypeConstants.Vendor,
                                     City = "La Vergne",
                                     State = "TN",
                                     Zip = "39234"
                                 });
            return order;
        }
 public void will_throw_exception_if_no_lines()
 {
     var order = new InvoicedOrderMessage {Customer = new Customer(), ControlNumber = "23443"};
     _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);
 }