示例#1
0
        public void AbstractionSerialize_ArrayOfObjects()
        {
            var mock = AbstractionMocks.GetArrayOfObjectsMock();

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

            Assert.IsNotNull(result);
            Assert.AreEqual(GetNormalizedJson(mock.JsonData), result);
        }
示例#2
0
        public void AbstractionDeserialize_ArrayOfObjects()
        {
            var mock = AbstractionMocks.GetArrayOfObjectsMock();

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

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