using NUnit.Framework; using System; using System.Linq; using System.Collections.Generic; namespace LeanCloud.Test { public class JustTest { [Test] public void Concat() { Dictionary d1 = new Dictionary { { "aaa", "111" } }; Dictionary d2 = new Dictionary { { "aaa", "222" }, { "ccc", "333" } }; IEnumerable> d = d1.Concat(d2); foreach (var e in d) { TestContext.Out.WriteLine($"{e.Key} : {e.Value}"); } List l1 = new List { "aaa" }; List l2 = new List { "aaa", "bbb" }; IEnumerable l = l1.Concat(l2); foreach (var e in l) { TestContext.Out.WriteLine($"{e}"); } } [Test] public void Zip() { List l1 = new List { 1, 2, 3, 4 }; List l2 = new List { 1, 1, 2 }; var l3 = l1.Zip(l2, (e1, e2) => $"{e1}-{e2}"); foreach (var e in l3) { TestContext.Out.WriteLine($"{e}"); } } [Test] public void GenericType() { List list = new List { 1, 1, 2, 3, 5, 8 }; Type type = list.GetType(); TestContext.Out.WriteLine(type); Type genericType = type.GetGenericTypeDefinition(); TestContext.Out.WriteLine(genericType); TestContext.Out.WriteLine(typeof(IList<>)); TestContext.Out.WriteLine(typeof(List<>)); } } }