예제 #1
0
        private static OrderHasBeenShippedMessage CreateInitechOrderHasBeenShippedMessageWithThreeLines()
        {
            var order = new OrderHasBeenShippedMessage
            {
                BOL                   = "00999998",
                CustomerPO            = "AFC000001",
                BusinessPartnerCode   = BusinessPartner.Initech.Code,
                BusinessPartnerNumber = BusinessPartner.Initech.Number,
                ControlNumber         = "50001"
            };

            order.Add(new ShippedLine
            {
                CustomerPartNo = "910021",
                DateShipped    = SystemTime.Now(),
                ItemID         = "910021",
                LineNumber     = "1",
                QtyOrdered     = 1,
                QtyShipped     = 1,
                UOM            = "EA"
            });
            order.Add(new ShippedLine
            {
                CustomerPartNo = "910022",
                DateShipped    = SystemTime.Now(),
                ItemID         = "910022",
                LineNumber     = "2",
                QtyOrdered     = 2,
                QtyShipped     = 2,
                UOM            = "EA"
            });
            order.AddAddress(new Address
            {
                AddressType = AddressTypeConstants.ShipFrom,
                Address1    = "2343 Grimes",
                City        = "Austin",
                State       = "TX",
                Zip         = "78987",
                AddressName = "Austin Foam Plastics"
            });
            order.AddAddress(new Address
            {
                AddressType = AddressTypeConstants.ShipTo,
                Address1    = " 590 BROADWAY",
                City        = "MENANDS",
                State       = "NY",
                Zip         = "12204",
                AddressName = "FEDERAL EXPRESS"
            });
            order.Lines.Where(l => l.LineNumber == "1").First().TrackingNumbers.Add("99999994");
            order.Lines.Where(l => l.LineNumber == "2").First().TrackingNumbers.Add("99999995");
            order.Lines.Where(l => l.LineNumber == "2").First().TrackingNumbers.Add("99999996");
            return(order);
        }
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new OrderHasBeenShippedMessage();
            message.Add(new ShippedLine());
            var ediContentCreator = new Mock<ICreateEdiContentFrom<OrderHasBeenShippedMessage>>();
            var buildValues = new EdiXmlBuildValues {ElementDelimiter = "~", SegmentDelimiter = "\n"};
            //            ediContentCreator.Setup(c => c.ReceiverId).Returns("xxxi");
            //            ediContentCreator.Setup(c => c.ControlNumber).Returns(62);
            //            ediContentCreator.Setup(c => c.EdiXmlBuildValues).Returns(buildValues);
            //            ediContentCreator.Setup(c => c.FunctionalId).Returns("PO");

            _resolver.Setup(r => r.GetBuildValueFactoryFor(BusinessPartner.FedEx)).Returns(new FedExBuildValueFactory());
            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var document = new EDIXmlInterchangeControl(_seg);
            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
                .Returns(new EDITransmissionPackage(document, BusinessPartner.FedEx));
            _ediDocumentSaver.Setup(x => x.Save(It.IsAny<EDITransmissionPackage>()));
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);

            //ACT
            _sut.Consume(message);

            //ASSERT
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
예제 #3
0
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new OrderHasBeenShippedMessage();

            message.Add(new ShippedLine());
            var ediContentCreator = new Mock <ICreateEdiContentFrom <OrderHasBeenShippedMessage> >();

            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var document = new EDIXmlInterchangeControl(_seg);
            var package  = new EDITransmissionPackage(document, BusinessPartner.FedEx);

            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
            .Returns(package);
            _ediDocumentSaver.Setup(x => x.Save(It.IsAny <EDITransmissionPackage>()));
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);

            //ACT
            _sut.Consume(message);

            //ASSERT
            _executePostConsumeAction.Verify(x => x.Execute(message));
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
예제 #4
0
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new OrderHasBeenShippedMessage();

            message.Add(new ShippedLine());
            var ediContentCreator = new Mock <ICreateEdiContentFrom <OrderHasBeenShippedMessage> >();
            var buildValues       = new EdiXmlBuildValues {
                ElementDelimiter = "~", SegmentDelimiter = "\n"
            };

//            ediContentCreator.Setup(c => c.ReceiverId).Returns("xxxi");
//            ediContentCreator.Setup(c => c.ControlNumber).Returns(62);
//            ediContentCreator.Setup(c => c.EdiXmlBuildValues).Returns(buildValues);
//            ediContentCreator.Setup(c => c.FunctionalId).Returns("PO");

            _resolver.Setup(r => r.GetBuildValueFactoryFor(BusinessPartner.Initech)).Returns(new InitechBuildValueFactory());
            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var document = new EDIXmlInterchangeControl(_seg);

            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
            .Returns(new EDITransmissionPackage(document, BusinessPartner.Initech));
            _ediDocumentSaver.Setup(x => x.Save(It.IsAny <EDITransmissionPackage>()));
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);

            //ACT
            _sut.Consume(message);

            //ASSERT
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
 private static OrderHasBeenShippedMessage CreateInitechOrderHasBeenShippedMessageWithThreeLines()
 {
     var order = new OrderHasBeenShippedMessage
     {
         BOL = "00999998",
         CustomerPO = "AFC000001",
         BusinessPartnerCode = BusinessPartner.Initech.Code,
         BusinessPartnerNumber = BusinessPartner.Initech.Number,
         ControlNumber = "50001"
     };
     order.Add(new ShippedLine
     {
         CustomerPartNo = "910021",
         DateShipped = SystemTime.Now(),
         ItemID = "910021",
         LineNumber = "1",
         QtyOrdered = 1,
         QtyShipped = 1,
         UOM = "EA"
     });
     order.Add(new ShippedLine
     {
         CustomerPartNo = "910022",
         DateShipped = SystemTime.Now(),
         ItemID = "910022",
         LineNumber = "2",
         QtyOrdered = 2,
         QtyShipped = 2,
         UOM = "EA"
     });
     order.AddAddress(new Address
     {
         AddressType = AddressTypeConstants.ShipFrom,
         Address1 = "2343 Grimes",
         City = "Austin",
         State = "TX",
         Zip = "78987",
         AddressName = "Austin Foam Plastics"
     });
     order.AddAddress(new Address
     {
         AddressType = AddressTypeConstants.ShipTo,
         Address1 = " 590 BROADWAY",
         City = "MENANDS",
         State = "NY",
         Zip = "12204",
         AddressName = "FEDERAL EXPRESS"
     });
     order.Lines.Where(l => l.LineNumber == "1").First().TrackingNumbers.Add("99999994");
     order.Lines.Where(l => l.LineNumber == "2").First().TrackingNumbers.Add("99999995");
     order.Lines.Where(l => l.LineNumber == "2").First().TrackingNumbers.Add("99999996");
     return order;
 }
예제 #6
0
        private OrderHasBeenShippedMessage GetOrder()
        {
            var order = new OrderHasBeenShippedMessage
            {
                BOL                   = "0005456",
                CustomerPO            = "SRC009670",
                BusinessPartnerCode   = BusinessPartner.MicroCenter.Code,
                BusinessPartnerNumber = BusinessPartner.MicroCenter.Number,
                ControlNumber         = "60001"
            };

            order.Add(new ShippedLine
            {
                CustomerPartNo = "900104",
                DateShipped    = SystemTime.Now(),
                ItemID         = "FIN23430I044",
                LineNumber     = "1",
                QtyOrdered     = 3,
                QtyShipped     = 3,
                UOM            = "EA"
            });
            order.AddAddress(new Address
            {
                AddressType = AddressTypeConstants.ShipFrom,
                Address1    = "2343 Grimes",
                City        = "Austin",
                State       = "TX",
                Zip         = "78987",
                AddressName = "Austin Foam Plastics"
            });
            order.AddAddress(new Address
            {
                AddressType = AddressTypeConstants.ShipTo,
                Address1    = "90 FEDEX PARKWAY",
                City        = "COLLIERVILLE",
                State       = "TN",
                Zip         = "38017",
                AddressName = "FEDEX SUSIE CARNEY"
            });
            order.Lines.First().TrackingNumbers.Add("33532343");
            order.Lines.First().TrackingNumbers.Add("33577773");
            order.Lines.First().TrackingNumbers.Add("33577776");
            return(order);
        }
        public void can_notify_failure_of_CreateOrderMessage()
        {
            var message = new OrderHasBeenShippedMessage {BusinessPartnerCode = "WWT"};
            message.Add(new ShippedLine());

            var exception = new Exception("Test Exception");
            var fault = new Fault<OrderHasBeenShippedMessage>(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.LogisticsEmailAddress),
                                                It.Is<string>(body => body.Contains(message.ToString()) &&
                                                                      body.Contains(exception.ToString()))));
        }
예제 #8
0
        public void can_notify_failure_of_CreateOrderMessage()
        {
            var message = new OrderHasBeenShippedMessage {
                BusinessPartnerCode = "WWT"
            };

            message.Add(new ShippedLine());

            var exception = new Exception("Test Exception");
            var fault     = new Fault <OrderHasBeenShippedMessage>(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.LogisticsEmailAddress),
                                           It.Is <string>(body => body.Contains(message.ToString()) &&
                                                          body.Contains(exception.ToString()))));
        }
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new OrderHasBeenShippedMessage();
            message.Add(new ShippedLine());
            var ediContentCreator = new Mock<ICreateEdiContentFrom<OrderHasBeenShippedMessage>>();
            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var document = new EDIXmlInterchangeControl(_seg);
            var package = new EDITransmissionPackage(document, BusinessPartner.Initech);
            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
                .Returns(package);
            _ediDocumentSaver.Setup(x => x.Save(It.IsAny<EDITransmissionPackage>()));
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);

            //ACT
            _sut.Consume(message);

            //ASSERT
            _executePostConsumeAction.Verify(x => x.Execute(message));
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
 private static OrderHasBeenShippedMessage CreateInitechOrderHasBeenShippedMessageWithTwoLines()
 {
     var order = new OrderHasBeenShippedMessage
     {
         BOL = "0005456",
         CustomerPO = "SRC009670",
         BusinessPartnerCode = BusinessPartner.Initech.Code,
         BusinessPartnerNumber = BusinessPartner.Initech.Number,
         ControlNumber = "60001"
     };
     order.Add(new ShippedLine
     {
         CustomerPartNo = "900104",
         DateShipped = SystemTime.Now(),
         ItemID = "FIN23430I044",
         LineNumber = "1",
         QtyOrdered = 3,
         QtyShipped = 3,
         UOM = "EA"
     });
     order.AddAddress(new Address
     {
         AddressType = AddressTypeConstants.ShipFrom,
         Address1 = "2343 Grimes",
         City = "Austin",
         State = "TX",
         Zip = "78987",
         AddressName = "Austin Foam Plastics"
     });
     order.AddAddress(new Address
     {
         AddressType = AddressTypeConstants.ShipTo,
         Address1 = "90 Initech PARKWAY",
         City = "COLLIERVILLE",
         State = "TN",
         Zip = "38017",
         AddressName = "Initech SUSIE CARNEY"
     });
     order.Lines.First().TrackingNumbers.Add("33532343");
     order.Lines.First().TrackingNumbers.Add("33577773");
     return order;
 }