Exemple #1
0
        public void Save_ShouldNotCreateAndAppendElement_WhenValueIsNull()
        {
            NumericProperty <int> sut = CreateSut <int>();

            XmlDocument xmlDoc   = new XmlDocument();
            XmlElement  appender = xmlDoc.CreateElement("appender");

            sut.Save(xmlDoc, appender);

            Assert.IsNull(appender["numProp"]);
        }
Exemple #2
0
        public void Save_ShouldNotCreateAndAppendElement_WhenDefault()
        {
            NumericProperty <int> sut = new NumericProperty <int>("Num Prop:", "numProp", 1234)
            {
                Value = "1234"
            };

            XmlDocument xmlDoc   = new XmlDocument();
            XmlElement  appender = xmlDoc.CreateElement("appender");

            sut.Save(xmlDoc, appender);

            Assert.IsNull(appender["numProp"]);
        }
Exemple #3
0
        public void Save_ShouldCreateAndAppendCorrectElement_WhenNotDefault()
        {
            NumericProperty <int> sut = CreateSut <int>();

            const string value = "10000";

            sut.Value = value;
            XmlDocument xmlDoc   = new XmlDocument();
            XmlElement  appender = xmlDoc.CreateElement("appender");

            sut.Save(xmlDoc, appender);

            XmlElement numProp = appender["numProp"];

            Assert.IsNotNull(numProp);
            Assert.AreEqual(value, numProp.Attributes["value"].Value);
        }