Exemple #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);
        }
Exemple #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);
        }
Exemple #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));
            }
        }
Exemple #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));
            }
        }
Exemple #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));
                });
        }