public static void Ctor_IList() { var collection = new TestCollection <int>(s_intArray); Assert.Same(s_intArray, collection.GetItems()); Assert.Equal(s_intArray.Length, collection.Count); }
public static void GetItems_CastableToList() { // // Although MSDN only documents that Collection<T>.Items returns an IList<T>, // apps have made it through the Windows Store that successfully cast the return value // of Items to List<T>. // // Thus, we must grumble and continue to honor this behavior. // TestCollection <int> c = new TestCollection <int>(); IList <int> il = c.GetItems(); // Avoid using the List<T> type so that we don't have to depend on the System.Collections contract Type type = il.GetType(); Assert.Equal(1, type.GenericTypeArguments.Length); Assert.Equal(typeof(int), type.GenericTypeArguments[0]); Assert.Equal("System.Collections.Generic.List`1", string.Format("{0}.{1}", type.Namespace, type.Name)); }
public static void CreateFromIList() { var collection = new TestCollection <int>(s_intArray); Assert.Same(s_intArray, collection.GetItems()); }
public static void Ctor_IList() { var collection = new TestCollection <int>(s_intSet); Assert.Same(s_intSet, collection.GetItems()); }