using System; using System.Collections.Generic; using System.Linq; using System.Text; using Topten.JsonKit; using System.Collections; using Xunit; namespace TestCases { public class TestConcreteFromInterface { [Fact] public void TestGenericList() { var l = new List() { 10, 20, 30 }; var json = Json.Format(l); var l2 = Json.Parse>(json); Assert.IsType>(l2); Assert.Equal(l, l2); } [Fact] public void TestGenericDictionary() { var l = new Dictionary() { {"A", 10}, {"B", 20}, {"C", 30} }; var json = Json.Format(l); var l2 = Json.Parse>(json); Assert.IsType>(l2); Assert.Equal(l, l2); } [Fact] public void TestObjectList() { var l = new List() { 10, 20, 30 }; var json = Json.Format(l); var l2 = Json.Parse(json); Assert.IsType>(l2); Assert.Equal(l.Count, l2.Count); } [Fact] public void TestObjectDictionary() { var l = new Dictionary() { {"A", 10}, {"B", 20}, {"C", 30} }; var json = Json.Format(l); var l2 = Json.Parse(json); Assert.IsType>(l2); Assert.Equal(l.Count, l2.Count); } } }