コード例 #1
0
        public void AbstractionSerialize_ListOfStrings()
        {
            var mock = AbstractionMocks.GetListOfStringsMock();

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

            Assert.IsNotNull(result);
            Assert.AreEqual(GetNormalizedJson(mock.JsonData), result);
        }
コード例 #2
0
        public void AbstractionDeserialize_ListOfStrings()
        {
            var mock = AbstractionMocks.GetListOfStringsMock();

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

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <ListOfStrings>(result, "Wrong instance");
            Assert.AreEqual("Test", result.Param1);
            Assert.IsTrue(result.Collection.Count == 2);
            Assert.AreEqual("opt1", result.Collection[0]);
            Assert.AreEqual("opt2", result.Collection[1]);
        }