Ejemplo n.º 1
0
        public void AbstractionSerialize_ListOfObjects()
        {
            var mock = AbstractionMocks.GetListOfObjectsMock();

            var result = SerializeJson(mock.TestObject, mock.AbstractType);

            Assert.IsNotNull(result);
            Assert.AreEqual(GetNormalizedJson(mock.JsonData), result);
        }
Ejemplo n.º 2
0
        public void AbstractionDeserialize_ListOfObjects()
        {
            var mock = AbstractionMocks.GetListOfObjectsMock();

            var result = DeserializeJson <ListOfObjects>(mock.JsonData, mock.AbstractType);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <ListOfObjects>(result, "Wrong instance");
            Assert.AreEqual("Test", result.Param1);
            Assert.IsTrue(result.Collection.Count == 2);
            Assert.IsInstanceOf <List <Nested> >(result.Collection, "Wrong instance");
            Assert.AreEqual(3, result.Collection[0].Param1);
            Assert.AreEqual(4, result.Collection[1].Param1);
        }