Пример #1
0
        public void DeserializeSingleInstance()
        {
            XmlNode node   = TestUtil.GetElementForXml(TestListen360API.Properties.Resources.FakeFranchise1);
            object  result = ModelBase.Deserialize(_ctx.Listen360, node);

            Assert.NotNull(result);
            Assert.IsAssignableFrom(typeof(Franchise), result);
        }
Пример #2
0
        /// <summary>
        /// Updates <see cref="ModelBase"/> object with given xml data
        /// </summary>
        /// <param name="modelData">Xml data to update model</param>
        public void ReloadModel(XmlElement modelData)
        {
            ModelBase model = GetModelForElement(modelData);

            if (model != null)
            {
                model.Deserialize(modelData, SaveContext.Undo);
            }
        }
Пример #3
0
        public void DeserializeEmptyArray()
        {
            XmlNode node   = TestUtil.GetElementForXml("<records type=\"array\"></records>");
            object  result = ModelBase.Deserialize(_ctx.Listen360, node);

            Assert.NotNull(result);
            Assert.IsAssignableFrom(typeof(ArrayList), result);

            ArrayList list = (ArrayList)result;

            Assert.AreEqual(0, list.Count);
        }
Пример #4
0
        public void DeserializeArray()
        {
            XmlNode node   = TestUtil.GetElementForXml(string.Format("<records type=\"array\">{0}{1}</records>", TestListen360API.Properties.Resources.FakeFranchisor1, TestListen360API.Properties.Resources.FakeFranchise1));
            object  result = ModelBase.Deserialize(_ctx.Listen360, node);

            Assert.NotNull(result);
            Assert.IsAssignableFrom(typeof(ArrayList), result);

            ArrayList list = (ArrayList)result;

            Assert.AreEqual(2, list.Count);
            Assert.IsAssignableFrom(typeof(Franchisor), list[0]);
            Assert.IsAssignableFrom(typeof(Franchise), list[1]);
        }