예제 #1
0
        public void TestSingleDimensionalArrays()
        {
            DefType      systemArrayType    = _context.GetWellKnownType(WellKnownType.Array);
            MetadataType systemIListOfTType = _testModule.GetType("System.Collections.Generic", "IList`1");

            TypeDesc objectType = _context.GetWellKnownType(WellKnownType.Object);

            ArrayType objectArray = _context.GetArrayType(objectType);

            // The set of interfaces on an array shall start with the same set that exists on System.Array
            for (int i = 0; i < systemArrayType.RuntimeInterfaces.Length; i++)
            {
                Assert.Equal(systemArrayType.RuntimeInterfaces[i], objectArray.RuntimeInterfaces[i]);
            }

            // The set of interfaces on an array of type T shall include IList<T>
            TypeDesc ilistOfObject = _context.GetInstantiatedType(systemIListOfTType, new Instantiation(new TypeDesc[] { objectType }));

            Assert.Contains(ilistOfObject, objectArray.RuntimeInterfaces);
        }