示例#1
0
        public void CanBeConstructedFromClosedGenericClrTypes()
        {
            var closedEnumerable = new NamedType(typeof(IEnumerable <int>));

            closedEnumerable.ShouldEqual(
                "System.Collections.Generic.IEnumerable",
                "System.Collections.Generic.IEnumerable<int>",
                NamedType.Integer);
        }
示例#2
0
        public void CanBeConstructedFromClosedGenericClrTypes()
        {
            var closedEnumerable = new NamedType(typeof(IEnumerable<int>));

            closedEnumerable.ShouldEqual(
                "System.Collections.Generic.IEnumerable",
                "System.Collections.Generic.IEnumerable<int>",
                NamedType.Integer);
        }
示例#3
0
        public void CanBeConstructedFromOpenGenericClrTypes()
        {
            using (TypeVariable.TestFactory())
            {
                var openEnumerable = new NamedType(typeof(IEnumerable <>));

                openEnumerable.ShouldEqual(
                    "System.Collections.Generic.IEnumerable",
                    "System.Collections.Generic.IEnumerable<0>",
                    new TypeVariable(0));
            }
        }
示例#4
0
        public void CanBeConstructedFromOpenGenericClrTypes()
        {
            using (TypeVariable.TestFactory())
            {
                var openEnumerable = new NamedType(typeof(IEnumerable<>));

                openEnumerable.ShouldEqual(
                    "System.Collections.Generic.IEnumerable",
                    "System.Collections.Generic.IEnumerable<0>",
                    new TypeVariable(0));
            }
        }
示例#5
0
        public void CanBeConstructedFromRookClassDeclarationsIncludingMethods()
        {
            var @class = "class Foo { int Square(int x) {x*x} }".ParseClass();

            var foo = new NamedType(@class, new TypeRegistry());
            foo.ShouldEqual("Foo", "Foo");

            foo.Methods.ShouldList(
                method =>
                {
                    method.Identifier.ShouldEqual("Square");
                    method.Type.ShouldEqual(NamedType.Function(new[] {NamedType.Integer}, NamedType.Integer));
                });
        }