public void CanCreateXmlFromDiscountDetailList()
        {
            List<DiscountDetail> details = new List<DiscountDetail>();
            DiscountDetail d1 = new DiscountDetail() { Description = "Hello, World", Amount = -1.56m };
            details.Add(d1);
            DiscountDetail d2 = new DiscountDetail() { Description = "Cool Item Two", Amount = -1.10m };
            details.Add(d2);

            string expected = "<DiscountDetails>" + System.Environment.NewLine;
            
            expected += "  <DiscountDetail>" + System.Environment.NewLine;
            expected += "    <Id>" + d1.Id.ToString() + "</Id>" + System.Environment.NewLine;
            expected += "    <Description>Hello, World</Description>" + System.Environment.NewLine;
            expected += "    <Amount>-1.56</Amount>" + System.Environment.NewLine;
            expected += "  </DiscountDetail>" + System.Environment.NewLine;

            expected += "  <DiscountDetail>" + System.Environment.NewLine;
            expected += "    <Id>" + d2.Id.ToString() + "</Id>" + System.Environment.NewLine;
            expected += "    <Description>Cool Item Two</Description>" + System.Environment.NewLine;
            expected += "    <Amount>-1.10</Amount>" + System.Environment.NewLine;
            expected += "  </DiscountDetail>" + System.Environment.NewLine;

            expected += "</DiscountDetails>";

            string actual;
            actual = DiscountDetail.ListToXml(details);
            Assert.AreEqual(expected, actual);
        }
 public void CanReadDiscountDetailListFromXml()
 {
     List<DiscountDetail> details = new List<DiscountDetail>();
     DiscountDetail d1 = new DiscountDetail() { Description = "Hello, World", Amount = -1.56m };
     details.Add(d1);
     DiscountDetail d2 = new DiscountDetail() { Description = "Cool Item Two", Amount = -1.10m };
     details.Add(d2);
     string xml = DiscountDetail.ListToXml(details);
     
     List<DiscountDetail> actual;
     actual = DiscountDetail.ListFromXml(xml);
     
     Assert.AreEqual(details.Count, actual.Count, "Count of items didn't match");
     for (int i = 0; i < details.Count; i++)
     {
         Assert.AreEqual(details[i].Amount, actual[i].Amount, "Amount Didn't Match");
         Assert.AreEqual(details[i].Description, actual[i].Description, "Description Didn't Match");
         Assert.AreEqual(details[i].Id, actual[i].Id, "Id Didn't Match");
     }
 }