Exemplo n.º 1
0
        public TypeLambda(IModuleLambda moduleLambda)
        {
            this.ModuleLambda = moduleLambda;

            // Init
            this.typeAccessor	= new TypeAccessor(this);
            this.methodAccessor = new MethodAccessor(this);
            this.fieldAccessor	= new FieldAccessor(this);

            this.accessorInvocation = new AccessorInvocation(this, typeAccessor, methodAccessor, fieldAccessor);
        }
Exemplo n.º 2
0
        public TypeLambda(IModuleLambda moduleLambda)
        {
            this.ModuleLambda = moduleLambda;

            // Init
            this.typeAccessor   = new TypeAccessor(this);
            this.methodAccessor = new MethodAccessor(this);
            this.fieldAccessor  = new FieldAccessor(this);

            this.accessorInvocation = new AccessorInvocation(this, typeAccessor, methodAccessor, fieldAccessor);
        }
Exemplo n.º 3
0
        public void Invoke_Test()
        {
            var assembly = new AssemblyLambda();

            {
                var module = assembly.Assembly("A").Module("A");
                {
                    var type = module.Class(Guid.NewGuid().ToString("N"));

                    var typeAccessor   = new TypeAccessor(type);
                    var methodAccessor = new MethodAccessor(type);
                    var fieldAccessor  = new FieldAccessor(type);

                    var invocation = new AccessorInvocation(type, typeAccessor, methodAccessor, fieldAccessor);

                    var t = invocation.Public;
                    t = invocation.Abstract;
                    t = invocation.Abstract;

                    TestContext.WriteLine("TypeAttribute is {0}", typeAccessor.TypeAttributes.ToString());
                    TestContext.WriteLine("MethodAttribute is {0}", methodAccessor.MethodAttribute.ToString());
                    TestContext.WriteLine("FieldAttribute is {0}", fieldAccessor.FieldAttribute.ToString());


                    // Assert Type
                    Assert.IsTrue((typeAccessor.TypeAttributes & TypeAttributes.Class) == TypeAttributes.Class);
                    Assert.IsTrue((typeAccessor.TypeAttributes & TypeAttributes.Abstract) == TypeAttributes.Abstract);
                    Assert.IsFalse((typeAccessor.TypeAttributes & TypeAttributes.Interface) == TypeAttributes.Interface);

                    // Assert Method
                    Assert.IsTrue((methodAccessor.MethodAttribute & MethodAttributes.Public) == MethodAttributes.Public);
                    Assert.IsTrue((methodAccessor.MethodAttribute & MethodAttributes.Abstract) == MethodAttributes.Abstract);
                    Assert.IsFalse((methodAccessor.MethodAttribute & MethodAttributes.Virtual) == MethodAttributes.Virtual);

                    // Assert Field
                    Assert.IsTrue((fieldAccessor.FieldAttribute & FieldAttributes.Public) == FieldAttributes.Public);
                    Assert.IsFalse((fieldAccessor.FieldAttribute & FieldAttributes.Static) == FieldAttributes.Static);
                };
            };
        }
Exemplo n.º 4
0
        public void Invoke_Test()
        {
            var assembly = new AssemblyLambda();
            {
                var module = assembly.Assembly("A").Module("A");
                {
                    var type = module.Class(Guid.NewGuid().ToString("N"));

                    var typeAccessor = new TypeAccessor(type);
                    var methodAccessor = new MethodAccessor(type);
                    var fieldAccessor = new FieldAccessor(type);

                    var invocation = new AccessorInvocation(type, typeAccessor, methodAccessor, fieldAccessor);

                    var t = invocation.Public;
                    t = invocation.Abstract;
                    t = invocation.Abstract;

                    TestContext.WriteLine("TypeAttribute is {0}", typeAccessor.TypeAttributes.ToString());
                    TestContext.WriteLine("MethodAttribute is {0}", methodAccessor.MethodAttribute.ToString());
                    TestContext.WriteLine("FieldAttribute is {0}", fieldAccessor.FieldAttribute.ToString());

                    // Assert Type
                    Assert.IsTrue((typeAccessor.TypeAttributes & TypeAttributes.Class) == TypeAttributes.Class);
                    Assert.IsTrue((typeAccessor.TypeAttributes & TypeAttributes.Abstract) == TypeAttributes.Abstract);
                    Assert.IsFalse((typeAccessor.TypeAttributes & TypeAttributes.Interface) == TypeAttributes.Interface);

                    // Assert Method
                    Assert.IsTrue((methodAccessor.MethodAttribute & MethodAttributes.Public) == MethodAttributes.Public);
                    Assert.IsTrue((methodAccessor.MethodAttribute & MethodAttributes.Abstract) == MethodAttributes.Abstract);
                    Assert.IsFalse((methodAccessor.MethodAttribute & MethodAttributes.Virtual) == MethodAttributes.Virtual);

                    // Assert Field
                    Assert.IsTrue((fieldAccessor.FieldAttribute & FieldAttributes.Public) == FieldAttributes.Public);
                    Assert.IsFalse((fieldAccessor.FieldAttribute & FieldAttributes.Static) == FieldAttributes.Static);
                };
            };
        }