Exemplo n.º 1
0
        public void SOrderTest_Execution_Failure_Mock()
        {
            string       wsUrl  = "http://10.0.1.7:8080/mock_Failure"; // TODO: Initialize to an appropriate value
            SOrder       target = new SOrder(wsUrl);
            OrdHeaderDto header = new OrdHeaderDto()
            {
                doc_Type    = "ZTA",
                sales_Org   = "7460",
                channel     = "00",
                division    = "03",
                ship_Cond   = "01",
                country     = "CO",
                currency    = "COP",
                purch_Ord   = "",
                order_Dte   = "20130725",
                inbo_Outb   = "",
                agent       = "",
                cond_Man    = "",
                cap_Min     = "",
                cap_Max     = "",
                ship_Method = ""
            };

            OrdItemDto[] items = new OrdItemDto[2]
            {
                new OrdItemDto()
                {
                    Item     = "",
                    Material = "20018265",
                    Dlv_Grp  = "",
                    Tar_Qty  = "",
                    Tar_QU   = "",
                    Req_Qty  = "10",
                    Req_Dte  = "",
                    Req_Time = "",
                    Item_typ = "",
                    Paym_Trm = "",
                    Plant    = "F072"
                },
                new OrdItemDto()
                {
                    Item     = "",
                    Material = "60003350",
                    Dlv_Grp  = "",
                    Tar_Qty  = "",
                    Tar_QU   = "",
                    Req_Qty  = "10",
                    Req_Dte  = "",
                    Req_Time = "",
                    Item_typ = "",
                    Paym_Trm = "",
                    Plant    = "F072"
                }
            };

            OrdPartnerDto[] partners = new OrdPartnerDto[1]
            {
                new OrdPartnerDto()
                {
                    Part_Role   = "SH",
                    Part_Number = ""
                }
            };

            SoParametersDto parameters = new SoParametersDto
            {
                Header  = header,
                Item    = items,
                Partner = partners
            };

            var actual = CustomerStatementTest_LogicExec(wsUrl, "ITOPERCOL", "cemex2011", parameters);

            var expected = new SoResponseDto()
            {
                ExceptionMessageList = new SoRespErrorMsgList[1]
                {
                    new SoRespErrorMsgList()
                    {
                        Type      = "",
                        Id        = "",
                        Number    = "211",
                        Message   = "",
                        MessageV1 = "",
                        MessageV2 = "",
                        MessageV3 = "",
                        MessageV4 = ""
                    }
                },
                OutList = null
            };

            //var expected = new CsResponseDto()
            //{
            //    Exception = "SHIPTO_NOT_FOUND"
            //};
            Assert.IsTrue(actual.ExceptionMessageList != null);
            Assert.AreEqual(actual.ExceptionMessageList[0].Number, expected.ExceptionMessageList[0].Number);
        }
Exemplo n.º 2
0
        public void SOrderTest_Execution_Regular_Mock()
        {
            string wsUrl = "http://10.0.1.7:8088/mockZB_ORDTAKINGCRM"; // TODO: Initialize to an appropriate value

            SOrder       target = new SOrder(wsUrl);
            OrdHeaderDto header = new OrdHeaderDto()
            {
                doc_Type    = "ZTA",
                sales_Org   = "7460",
                channel     = "00",
                division    = "03",
                ship_Cond   = "01",
                country     = "CO",
                currency    = "COP",
                purch_Ord   = "",
                order_Dte   = "20130725",
                inbo_Outb   = "",
                agent       = "",
                cond_Man    = "",
                cap_Min     = "",
                cap_Max     = "",
                ship_Method = ""
            };

            OrdItemDto[] items = new OrdItemDto[2]
            {
                new OrdItemDto()
                {
                    Item     = "",
                    Material = "20018265",
                    Dlv_Grp  = "",
                    Tar_Qty  = "",
                    Tar_QU   = "",
                    Req_Qty  = "10",
                    Req_Dte  = "",
                    Req_Time = "",
                    Item_typ = "",
                    Paym_Trm = "",
                    Plant    = "F072"
                },
                new OrdItemDto()
                {
                    Item     = "",
                    Material = "60003350",
                    Dlv_Grp  = "",
                    Tar_Qty  = "",
                    Tar_QU   = "",
                    Req_Qty  = "10",
                    Req_Dte  = "",
                    Req_Time = "",
                    Item_typ = "",
                    Paym_Trm = "",
                    Plant    = "F072"
                }
            };

            OrdPartnerDto[] partners = new OrdPartnerDto[1]
            {
                new OrdPartnerDto()
                {
                    Part_Role   = "SH",
                    Part_Number = "65603243"
                }
            };

            SoParametersDto parameters = new SoParametersDto
            {
                Header  = header,
                Item    = items,
                Partner = partners
            };

            var actual = CustomerStatementTest_LogicExec(wsUrl, "ITOPERCOL", "cemex2011", parameters);

            var expected = new SoResponseDto()
            {
                ExceptionMessageList = null,
                OutList = new SoRespOutList[2]
                {
                    new SoRespOutList()
                    {
                        Item             = "",
                        Material         = "",
                        NetVal           = 0,
                        NetValSpecified  = true,
                        TaxVal           = 0,
                        TaxValSpecified  = true,
                        Currency         = "",
                        SalesUnit        = "",
                        DelDate          = DateTime.Now,
                        DelDateSpecified = true,
                        SubTot           = 304720400,
                        SubTotSpecified  = true,
                        TaxTot           = 0,
                        TaxTotSpecified  = true,
                        ItemCat          = "",
                        Plant            = "",
                        ShipPoint        = "",
                        Conditions       = new SoRespCondList[1]
                        {
                            new SoRespCondList()
                            {
                                Cond_Code  = "",
                                Cond_Name  = "",
                                Cond_Value = "",
                                Cond_Type  = "",
                                Value_Cond = "",
                                Cond_Curr  = "",
                            }
                        }
                    },
                    new SoRespOutList()
                    {
                        Item             = "",
                        Material         = "",
                        NetVal           = 0,
                        NetValSpecified  = true,
                        TaxVal           = 0,
                        TaxValSpecified  = true,
                        Currency         = "",
                        SalesUnit        = "",
                        DelDate          = DateTime.Now,
                        DelDateSpecified = true,
                        SubTot           = 0,
                        SubTotSpecified  = true,
                        TaxTot           = 0,
                        TaxTotSpecified  = true,
                        ItemCat          = "",
                        Plant            = "",
                        ShipPoint        = "",
                        Conditions       = new SoRespCondList[1]
                        {
                            new SoRespCondList()
                            {
                                Cond_Code  = "",
                                Cond_Name  = "",
                                Cond_Value = "",
                                Cond_Type  = "",
                                Value_Cond = "",
                                Cond_Curr  = "",
                            }
                        }
                    }
                }
            };


            Assert.AreEqual(expected.OutList[0].SubTot, actual.OutList[0].SubTot);
            Assert.AreEqual(expected.OutList[1].SubTot, actual.OutList[1].SubTot);
        }