Exemplo n.º 1
0
        public void GetMatchingDetailsForOrderNumber()
        {
            //Arrange
            OrderDataLines            dataLines = SetupOrderDataLines_List(fakeOrderList, "PO2008 - 01");
            Mock <OrderDetailsMapper> mockOrderDetailsMapper = new Mock <OrderDetailsMapper>();
            OrderDetailsReader        sut = new OrderDetailsReader(dataLines, mockOrderDetailsMapper.Object);

            //Assert
            Assert.Equal(2, sut.GetPurchaseOrderLineList().Count);
        }
Exemplo n.º 2
0
        public void MissingLineNumberForOrderDetails()
        {
            //arrange
            OrderDataLines            orderLines             = SetupOrderDataLines_Single("D,PO2008 - 01,,RED LOUNGES,100,", "PO2008 - 01");
            Mock <OrderDetailsMapper> mockOrderDetailsMapper = new Mock <OrderDetailsMapper>();
            OrderDetailsReader        sut = new OrderDetailsReader(orderLines, mockOrderDetailsMapper.Object);

            //assert
            Assert.Throws <Exception>(() => sut.GetPurchaseOrderLineList());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get Purchase order based on both the Header and Details
        /// </summary>
        /// <param name="orderDataLine"></param>
        /// <returns></returns>
        public PurchaseOrder GetPurchaseOrder(OrderDataLines orderDataLine)
        {
            PurchaseOrder purchaseOrder = new PurchaseOrder();

            //Get the Header for the orderKey
            OrderHeaderReader header = new OrderHeaderReader(orderDataLine, orderHeaderMapper);

            purchaseOrder = header.GetPurchaseOrder();

            //Then Get the Order Line list for that orderKey
            OrderDetailsReader content = new OrderDetailsReader(orderDataLine, orderDetailsMapper);

            purchaseOrder.Lines = content.GetPurchaseOrderLineList();

            return(purchaseOrder);
        }