public void ShouldResolveStaticMemberOfExternalClass()
 {
     var csharp = DecompilationResult.CreateFromDelegate <NullCursor, string>(_delegateReader, (cursor, args, keys) =>
     {
         return(SomeInterace.SomeKey);
     });
     var redIL = _csharpCompiler.Compile(csharp) as RootNode;
 }
 public void ShouldResolveArrayLength()
 {
     var csharp = DecompilationResult.CreateFromDelegate <NullCursor, int>(_delegateReader, (cursor, args, keys) =>
     {
         var arr = new int[] { 1, 2, 3 };
         return(arr.Length);
     });
     var redIL = _csharpCompiler.Compile(csharp) as RootNode;
 }
 public void ShouldResolveMethodOfExternalClass()
 {
     var csharp = DecompilationResult.CreateFromDelegate <NullCursor, string>(_delegateReader, (cursor, args, keys) =>
     {
         var foo = new SomeInterace("abc");
         return(foo.Greeting("def"));
     });
     var redIL = _csharpCompiler.Compile(csharp) as RootNode;
 }
        public void ShouldResolveConstructor()
        {
            var csharp = DecompilationResult.CreateFromDelegate <NullCursor, bool>(_delegateReader, (cursor, args, keys) =>
            {
                var foo = new Foo <double>(3.5);
                return(true);
            });
            var redIL = _csharpCompiler.Compile(csharp) as RootNode;
            var block = redIL.Body as BlockNode;

            block.Children.Count.Should().Be(2);
            var varDec = block.Children.First() as VariableDeclareNode;

            varDec.Value.Should().BeEquivalentTo(new ConstantValueNode(DataValueType.Float, (double)3.5));
        }
        public void ShouldResolveMethod()
        {
            var csharp = DecompilationResult.CreateFromDelegate <NullCursor, bool>(_delegateReader, (cursor, args, keys) =>
            {
                var foo = new Foo();
                foo.SetNumber(10);
                return(true);
            });
            var redIL = _csharpCompiler.Compile(csharp) as RootNode;
            var block = redIL.Body as BlockNode;

            block.Children.Count.Should().Be(3);
            var assign = block.Children.Skip(1).First() as AssignNode;

            assign.Right.Should().BeEquivalentTo(new ConstantValueNode(DataValueType.Integer, 10));
        }
        public void ShouldResolveMember()
        {
            var csharp = DecompilationResult.CreateFromDelegate <NullCursor, int>(_delegateReader, (cursor, args, keys) =>
            {
                var foo = new Foo(17);
                return(foo.Number);
            });
            var redIL = _csharpCompiler.Compile(csharp) as RootNode;
            var block = redIL.Body as BlockNode;

            block.Children.Count.Should().Be(2);
            var dec = block.Children.First() as VariableDeclareNode;
            var ret = block.Children.Last() as ReturnNode;

            ret.Value.Should().BeEquivalentTo(new IdentifierNode(dec.Name.ToString(), DataValueType.Integer));
        }
        public void ShouldResolveMethod()
        {
            var csharp = DecompilationResult.CreateFromDelegate <NullCursor, double>(_delegateReader, (cursor, args, keys) =>
            {
                var foo = new Foo <double>(4);
                return(foo.GetNumber());
            });
            var redIL = _csharpCompiler.Compile(csharp) as RootNode;
            var block = redIL.Body as BlockNode;

            block.Children.Count.Should().Be(2);
            var dec = block.Children.First() as VariableDeclareNode;
            var ret = block.Children.Last() as ReturnNode;

            ret.Value.Type.Should().Be(RedILNodeType.Parameter);
            (ret.Value as IdentifierNode).Name.Should().Be(dec.Name.ToString());
        }