예제 #1
0
        public void Init()
        {
            products = new DataTable();
            products.Columns.Add("Name");
            products.Columns.Add("Price");
            products.Columns.Add("Discounts", typeof(IEnumerable<Discount>));

            disA = new VolumeDiscount(7.00, 4);
            disC = new VolumeDiscount(6.00, 6);
            packA = new Discount[] { disA };
            packC = new Discount[] { disC };

            DataRow a = products.NewRow();
            a["Name"] = "A";
            a["Price"] = 2.00;
            a["Discounts"] = packA;

            DataRow b = products.NewRow();
            b["Name"] = "B";
            b["Price"] = 12.00;

            DataRow c = products.NewRow();
            c["Name"] = "C";
            c["Price"] = 1.25;
            c["Discounts"] = packC;

            DataRow d = products.NewRow();
            d["Name"] = "D";
            d["Price"] = 0.15;

            products.Rows.Add(a);
            products.Rows.Add(b);
            products.Rows.Add(c);
            products.Rows.Add(d);
        }
예제 #2
0
 public void ConstructorTest()
 {
     var volume = new VolumeDiscount(7.00, 4);
     Assert.AreEqual(volume.discountPrice, 7.00);
     Assert.AreEqual(volume.discountQuantity, 4);
     Assert.AreEqual(volume.discountType, DiscountType.Volume);
 }
예제 #3
0
        public void ConstructorTest()
        {
            var discount = new VolumeDiscount(7.00, 4);
            var discounts = new Discount[] { discount };

            var a = new Product("A", 2.00, discounts);
            Assert.AreEqual(a.GetName(), "A");
            Assert.AreEqual(a.GetPrice(), 2.00);
            Assert.AreEqual(a.GetDiscounts(), discounts);
        }
예제 #4
0
 public void Init()
 {
     discount = new VolumeDiscount(7.00, 4);
     discounts = new Discount[] { discount };
 }
예제 #5
0
파일: CartTest.cs 프로젝트: john-dodson/API
 public void Init()
 {
     discount = new VolumeDiscount(7.00, 4);
     discount2 = new VolumeDiscount(6.00, 6);
     discounts = new Discount[] { discount };
     discounts2 = new Discount[] { discount2 };
     product = new Product("A", 2.00, discounts);
     product2 = new Product("B", 12.00);
     product3 = new Product("C", 1.25, discounts2);
     product4 = new Product("D", 0.15);
 }