/// <summary>
        /// test getValueDiscounts() and check result against created PriceListAssignment
        /// </summary>
        /// <param name="alreadyUpdated">check result against created or updated PriceListAssignment</param>
        public void getValueDiscounts()
        {
            ArrayList PriceListAssignments_out = serviceClient.getValueDiscounts(new string[] { product }, new string[] { pricelist });

            // test if getinfo was successful and if all data are equal to input
            Assert.AreEqual(1, PriceListAssignments_out.Count, "get info result set");

            TGetValueDiscounts_Return PriceListAssignment_out = (TGetValueDiscounts_Return)PriceListAssignments_out.ToArray()[0];

            Assert.AreEqual(product, PriceListAssignment_out.Product, "product path");

            Assert.AreEqual(1, PriceListAssignment_out.PriceLists.Length, "PriceLists result set");
            TPriceListValueDiscount mypricelist = PriceListAssignment_out.PriceLists[0];

            Assert.AreEqual(pricelist, mypricelist.PriceList, "PriceLists path");

            Assert.AreEqual(valueDiscounts[0].Value, mypricelist.ValueDiscounts[0].Value, "ValueDiscount Value");
            Assert.AreEqual(valueDiscounts[0].Discount, mypricelist.ValueDiscounts[0].Discount, "ValueDiscount Discount");
            Assert.AreEqual(valueDiscounts[1].Value, mypricelist.ValueDiscounts[1].Value, "ValueDiscount Value");
            Assert.AreEqual(valueDiscounts[1].Discount, mypricelist.ValueDiscounts[1].Discount, "ValueDiscount Discount");
        }
Beispiel #2
0
        /// <summary>
        /// use stub to get info of a ValueDiscounts via web services
        /// </summary>
        /// <param name="products">Array of product paths</param>
        /// <param name="pricelists">Array of price list paths</param>
        /// <returns>ArrayList of TGetValueDiscounts_Return</returns>
        public ArrayList getValueDiscounts(string[] products, string[] pricelists)
        {
            TGetValueDiscounts_Return[] PriceListAssignments_out = stub.getValueDiscounts(products, pricelists);

            ArrayList result = new ArrayList();

            for (int i = 0; i < PriceListAssignments_out.Length; i++)
            {
                TGetValueDiscounts_Return PriceListAssignment_out = PriceListAssignments_out[i];

                if (PriceListAssignment_out.Error == null)
                {
                    Console.WriteLine("successfully retrieved ValueDiscounts for Product: " + PriceListAssignment_out.Product);
                    result.Add(PriceListAssignment_out);
                }
                else
                {
                    Console.WriteLine("an error occured (Epages Error):\n" + PriceListAssignment_out.Error.Message);
                }
            }

            return(result);
        }