예제 #1
0
        public void AbstractionSerialize_IListOfInterfaces()
        {
            var mock = AbstractionMocks.GetIListOfInterfacesMock();

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

            Assert.IsNotNull(result);
            Assert.AreEqual(GetNormalizedJson(mock.JsonData), result);
        }
예제 #2
0
        public void AbstractionSerialize_ArrayOfStrings()
        {
            var mock = AbstractionMocks.GetArrayOfStringsMock();

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

            Assert.IsNotNull(result);
            Assert.AreEqual(GetNormalizedJson(mock.JsonData), result);
        }
예제 #3
0
        public void AbstractionDeserialize_ArrayOfStrings()
        {
            var mock = AbstractionMocks.GetArrayOfStringsMock();

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

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <ArrayOfStrings>(result, "Wrong instance");
            Assert.AreEqual("Test", result.Param1);
            Assert.IsTrue(result.Collection.Length == 2);
            Assert.AreEqual("opt1", result.Collection[0]);
            Assert.AreEqual("opt2", result.Collection[1]);
        }
예제 #4
0
        public void AbstractionDeserialize_ListOfInterfaces()
        {
            var mock = AbstractionMocks.GetListOfInterfacesMock();

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

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