Esempio n. 1
0
        public void Promotion_ActionsToXmlTest()
        {
            var target = new Promotion();
            var a1     = new ProductPriceAdjustment(AmountTypes.MonetaryAmount, 1.23m);

            target.AddAction(a1);

            var expected = "<Actions>" + Environment.NewLine;

            expected += "  <Action>" + Environment.NewLine;
            expected += "    <Id>" + a1.Id + "</Id>" + Environment.NewLine;
            expected += "    <TypeId>" + a1.TypeId + "</TypeId>" + Environment.NewLine;
            expected += "    <Settings>" + Environment.NewLine;
            expected += "      <Setting>" + Environment.NewLine;
            expected += "        <Key>AdjustmentType</Key>" + Environment.NewLine;
            expected += "        <Value>1</Value>" + Environment.NewLine;
            expected += "      </Setting>" + Environment.NewLine;
            expected += "      <Setting>" + Environment.NewLine;
            expected += "        <Key>Amount</Key>" + Environment.NewLine;
            expected += "        <Value>1.23</Value>" + Environment.NewLine;
            expected += "      </Setting>" + Environment.NewLine;
            expected += "    </Settings>" + Environment.NewLine;
            expected += "  </Action>" + Environment.NewLine;

            expected += "</Actions>";

            string actual;

            actual = target.ActionsToXml();
            Assert.AreEqual(expected, actual);
        }