public void TestUpdateDiscount_OnlyRequired()
        {
            updateDiscount ud = new updateDiscount();

            ud.discountCode = "1";

            String actual   = ud.Serialize();
            String expected = @"
<discountCode>1</discountCode>";

            Assert.AreEqual(Regex.Replace(expected, @"\s+", String.Empty), Regex.Replace(actual, @"\s+", String.Empty));
        }
示例#2
0
        public void TestUpdateDiscount_OnlyRequired()
        {
            updateDiscount ud = new updateDiscount();

            ud.discountCode = "1";

            String actual   = ud.Serialize();
            String expected = @"
<discountCode>1</discountCode>";

            Assert.AreEqual(expected, actual);
        }
        public void testUpdateSubscription_CanContainUpdateDiscounts()
        {
            updateDiscount ud1 = new updateDiscount();

            ud1.discountCode = "1";
            ud1.name         = "cheaper";
            ud1.amount       = 200;
            ud1.startDate    = new DateTime(2013, 9, 5);
            ud1.endDate      = new DateTime(2013, 9, 6);

            updateDiscount ud2 = new updateDiscount();

            ud2.discountCode = "2";
            ud2.name         = "cheap";
            ud2.amount       = 100;
            ud2.startDate    = new DateTime(2013, 9, 3);
            ud2.endDate      = new DateTime(2013, 9, 4);

            updateSubscription update = new updateSubscription();

            update.subscriptionId = 1;
            update.updateDiscounts.Add(ud1);
            update.updateDiscounts.Add(ud2);

            String actual   = update.Serialize();
            String expected = @"
<updateSubscription>
<subscriptionId>1</subscriptionId>
<updateDiscount>
<discountCode>1</discountCode>
<name>cheaper</name>
<amount>200</amount>
<startDate>2013-09-05</startDate>
<endDate>2013-09-06</endDate>
</updateDiscount>
<updateDiscount>
<discountCode>2</discountCode>
<name>cheap</name>
<amount>100</amount>
<startDate>2013-09-03</startDate>
<endDate>2013-09-04</endDate>
</updateDiscount>
</updateSubscription>";

            Assert.AreEqual(Regex.Replace(expected, @"\s+", String.Empty), Regex.Replace(actual, @"\s+", String.Empty));
        }
        public void TestUpdateDiscount_Full()
        {
            updateDiscount ud = new updateDiscount();

            ud.discountCode = "1";
            ud.name         = "cheaper";
            ud.amount       = 200;
            ud.startDate    = new DateTime(2013, 9, 5);
            ud.endDate      = new DateTime(2013, 9, 6);

            String actual   = ud.Serialize();
            String expected = @"
<discountCode>1</discountCode>
<name>cheaper</name>
<amount>200</amount>
<startDate>2013-09-05</startDate>
<endDate>2013-09-06</endDate>";

            Assert.AreEqual(Regex.Replace(expected, @"\s+", String.Empty), Regex.Replace(actual, @"\s+", String.Empty));
        }
示例#5
0
        public void TestUpdateDiscount_Full()
        {
            var ud = new updateDiscount();

            ud.discountCode = "1";
            ud.name         = "cheaper";
            ud.amount       = 200;
            ud.startDate    = new DateTime(2013, 9, 5);
            ud.endDate      = new DateTime(2013, 9, 6);

            var actual   = ud.Serialize();
            var expected = @"
<discountCode>1</discountCode>
<name>cheaper</name>
<amount>200</amount>
<startDate>2013-09-05</startDate>
<endDate>2013-09-06</endDate>";

            Assert.AreEqual(expected, actual);
        }
        public void testUpdateSubscription_CanContainUpdateDiscounts()
        {
            updateDiscount ud1 = new updateDiscount();
            ud1.discountCode = "1";
            ud1.name = "cheaper";
            ud1.amount = 200;
            ud1.startDate = new DateTime(2013, 9, 5);
            ud1.endDate = new DateTime(2013, 9, 6);

            updateDiscount ud2 = new updateDiscount();
            ud2.discountCode = "2";
            ud2.name = "cheap";
            ud2.amount = 100;
            ud2.startDate = new DateTime(2013, 9, 3);
            ud2.endDate = new DateTime(2013, 9, 4);

            updateSubscription update = new updateSubscription();
            update.subscriptionId = 1;
            update.updateDiscounts.Add(ud1);
            update.updateDiscounts.Add(ud2);

            String actual = update.Serialize();
            String expected = @"
            <updateSubscription>
            <subscriptionId>1</subscriptionId>
            <updateDiscount>
            <discountCode>1</discountCode>
            <name>cheaper</name>
            <amount>200</amount>
            <startDate>2013-09-05</startDate>
            <endDate>2013-09-06</endDate>
            </updateDiscount>
            <updateDiscount>
            <discountCode>2</discountCode>
            <name>cheap</name>
            <amount>100</amount>
            <startDate>2013-09-03</startDate>
            <endDate>2013-09-04</endDate>
            </updateDiscount>
            </updateSubscription>";
            Assert.AreEqual(expected, actual);
        }
        public void TestUpdateDiscount_OnlyRequired()
        {
            updateDiscount ud = new updateDiscount();
            ud.discountCode = "1";

            String actual = ud.Serialize();
            String expected = @"
            <discountCode>1</discountCode>";
            Assert.AreEqual(expected, actual);
        }
        public void TestUpdateDiscount_Full()
        {
            updateDiscount ud = new updateDiscount();
            ud.discountCode = "1";
            ud.name = "cheaper";
            ud.amount = 200;
            ud.startDate = new DateTime(2013, 9, 5);
            ud.endDate = new DateTime(2013, 9, 6);

            String actual = ud.Serialize();
            String expected = @"
            <discountCode>1</discountCode>
            <name>cheaper</name>
            <amount>200</amount>
            <startDate>2013-09-05</startDate>
            <endDate>2013-09-06</endDate>";
            Assert.AreEqual(expected, actual);
        }