コード例 #1
0
        public void TestSubscription_CanContainCreateAddOns()
        {
            subscription subscription = new subscription();
            subscription.planCode = "123abc";

            createAddOn cao1 = new createAddOn();
            cao1.addOnCode = "1";
            cao1.name = "addOn1";
            cao1.amount = 100;
            cao1.startDate = new DateTime(2013, 9, 5);
            cao1.endDate = new DateTime(2013, 9, 6);

            createAddOn cao2 = new createAddOn();
            cao2.addOnCode = "2";
            cao2.name = "addOn2";
            cao2.amount = 200;
            cao2.startDate = new DateTime(2013, 9, 4);
            cao2.endDate = new DateTime(2013, 9, 5);

            subscription.createAddOns.Add(cao1);
            subscription.createAddOns.Add(cao2);

            String actual = subscription.Serialize();
            String expected = @"
            <planCode>123abc</planCode>
            <createAddOn>
            <addOnCode>1</addOnCode>
            <name>addOn1</name>
            <amount>100</amount>
            <startDate>2013-09-05</startDate>
            <endDate>2013-09-06</endDate>
            </createAddOn>
            <createAddOn>
            <addOnCode>2</addOnCode>
            <name>addOn2</name>
            <amount>200</amount>
            <startDate>2013-09-04</startDate>
            <endDate>2013-09-05</endDate>
            </createAddOn>";
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void testUpdateSubscription_CanContainCreateAddOns()
        {
            createAddOn cao1 = new createAddOn();
            cao1.addOnCode = "1";
            cao1.name = "addOn1";
            cao1.amount = 100;
            cao1.startDate = new DateTime(2013, 9, 5);
            cao1.endDate = new DateTime(2013, 9, 6);

            createAddOn cao2 = new createAddOn();
            cao2.addOnCode = "2";
            cao2.name = "addOn2";
            cao2.amount = 200;
            cao2.startDate = new DateTime(2013, 9, 4);
            cao2.endDate = new DateTime(2013, 9, 5);

            updateSubscription update = new updateSubscription();
            update.subscriptionId = 1;
            update.createAddOns.Add(cao1);
            update.createAddOns.Add(cao2);

            String actual = update.Serialize();
            String expected = @"
            <updateSubscription>
            <subscriptionId>1</subscriptionId>
            <createAddOn>
            <addOnCode>1</addOnCode>
            <name>addOn1</name>
            <amount>100</amount>
            <startDate>2013-09-05</startDate>
            <endDate>2013-09-06</endDate>
            </createAddOn>
            <createAddOn>
            <addOnCode>2</addOnCode>
            <name>addOn2</name>
            <amount>200</amount>
            <startDate>2013-09-04</startDate>
            <endDate>2013-09-05</endDate>
            </createAddOn>
            </updateSubscription>";
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void TestCreateAddOn()
        {
            createAddOn cao = new createAddOn();
            cao.addOnCode = "1";
            cao.name = "addOn1";
            cao.amount = 100;
            cao.startDate = new DateTime(2013, 9, 5);
            cao.endDate = new DateTime(2013, 9, 6);

            String actual = cao.Serialize();
            String expected = @"
            <addOnCode>1</addOnCode>
            <name>addOn1</name>
            <amount>100</amount>
            <startDate>2013-09-05</startDate>
            <endDate>2013-09-06</endDate>";
            Assert.AreEqual(expected, actual);
        }