public void TestCachingEnumerationAlgorithm()
        {
            var algo = new CachingVirtualMethodEnumerationAlgorithm();

            DefType objectType = _context.GetWellKnownType(WellKnownType.Object);
            var objectMethods = algo.ComputeAllVirtualMethods(objectType).ToArray();
            Assert.Equal(4, objectMethods.Length);
            Assert.Superset(new HashSet<string> { "Equals", "GetHashCode", "ToString", "Finalize" },
                new HashSet<string>(objectMethods.Select(m => m.Name)));

            var testTypeMethods = algo.ComputeAllVirtualMethods(_testType).ToArray();
            Assert.Equal(1, testTypeMethods.Length);
            Assert.Equal("ToString", testTypeMethods[0].Name);
            Assert.Equal(_testType, testTypeMethods[0].OwningType);
        }
Ejemplo n.º 2
0
        public void TestCachingEnumerationAlgorithm()
        {
            var algo = new CachingVirtualMethodEnumerationAlgorithm();

            DefType objectType    = _context.GetWellKnownType(WellKnownType.Object);
            var     objectMethods = algo.ComputeAllVirtualMethods(objectType).ToArray();

            Assert.Equal(4, objectMethods.Length);
            Assert.Superset(new HashSet <string> {
                "Equals", "GetHashCode", "ToString", "Finalize"
            },
                            new HashSet <string>(objectMethods.Select(m => m.Name)));

            var testTypeMethods = algo.ComputeAllVirtualMethods(_testType).ToArray();

            Assert.Equal(1, testTypeMethods.Length);
            Assert.Equal("ToString", testTypeMethods[0].Name);
            Assert.Equal(_testType, testTypeMethods[0].OwningType);
        }