using System; using System.Collections.Generic; using System.Linq; using System.Text; using PetaTest; using PetaJson; using System.Collections; namespace TestCases { [TestFixture] class TestConcreteFromInterface { [Test] public void TestGenericList() { var l = new List() { 10, 20, 30 }; var json = Json.Format(l); var l2 = Json.Parse>(json); Assert.IsInstanceOf(typeof(List), l2); Assert.AreEquivalent(l, l2); } [Test] public void TestGenericDictionary() { var l = new Dictionary() { {"A", 10}, {"B", 20}, {"C", 30} }; var json = Json.Format(l); var l2 = Json.Parse>(json); Assert.IsInstanceOf(typeof(Dictionary), l2); Assert.AreEquivalent(l, l2); } [Test] public void TestObjectList() { var l = new List() { 10, 20, 30 }; var json = Json.Format(l); var l2 = Json.Parse(json); Assert.IsInstanceOf(typeof(List), l2); Assert.AreEqual(l.Count, l2.Count); } [Test] public void TestObjectDictionary() { var l = new Dictionary() { {"A", 10}, {"B", 20}, {"C", 30} }; var json = Json.Format(l); var l2 = Json.Parse(json); Assert.IsInstanceOf(typeof(Dictionary), l2); Assert.AreEqual(l.Count, l2.Count); } } }