public void TestSubscription_CanContainCreateDiscounts()
        {
            var subscription = new Subscription
            {
                PlanCode = "123abc",
                CreateDiscounts =
                {
                    new CreateDiscount
                    {
                        DiscountCode = "1",
                        Name = "cheaper",
                        Amount = 200,
                        StartDate = new DateTime(2013, 9, 5),
                        EndDate = new DateTime(2013, 9, 6)
                    },
                    new CreateDiscount
                    {
                        DiscountCode = "2",
                        Name = "cheap",
                        Amount = 100,
                        StartDate = new DateTime(2013, 9, 3),
                        EndDate = new DateTime(2013, 9, 4)
                    }
                }
            };

            var actual = subscription.Serialize();
            var pattern = FormMatchExpression(
                "<planCode>123abc</planCode>",
                "<createDiscount>",
                "<discountCode>1</discountCode>",
                "<name>cheaper</name>",
                "<amount>200</amount>",
                "<startDate>2013-09-05</startDate>",
                "<endDate>2013-09-06</endDate>",
                "</createDiscount>",
                "<createDiscount>",
                "<discountCode>2</discountCode>",
                "<name>cheap</name>",
                "<amount>100</amount>",
                "<startDate>2013-09-03</startDate>",
                "<endDate>2013-09-04</endDate>",
                "</createDiscount>");
            var match = Regex.Match(actual, pattern);
            Assert.IsTrue(match.Success, actual);
        }
        public void TestSubscription_CanContainCreateAddOns()
        {
            var subscription = new Subscription
            {
                PlanCode = "123abc",
                CreateAddOns =
                {
                    new CreateAddOn
                    {
                        AddOnCode = "1",
                        Name = "addOn1",
                        Amount = 100,
                        StartDate = new DateTime(2013, 9, 5),
                        EndDate = new DateTime(2013, 9, 6)
                    },
                    new CreateAddOn
                    {
                        AddOnCode = "2",
                        Name = "addOn2",
                        Amount = 200,
                        StartDate = new DateTime(2013, 9, 4),
                        EndDate = new DateTime(2013, 9, 5)
                    }
                }
            };

            var actual = subscription.Serialize();
            const 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);
        }