コード例 #1
0
ファイル: CallAndNewTests.cs プロジェクト: ashmind/light
        public void NearbyMethodCallOnParameter(string returnValue, object expectedValue)
        {
            var compiled = CompilationHelper.CompileCode(string.Format(@"
                public class Callee
                    function GetValue()
                        return {0}
                    end
                end
                
                public class Caller
                    function GetValueFromCallee(Callee callee)
                        return callee.GetValue()
                    end
                end
            ", returnValue).Trim());

            var callee = (dynamic)Activator.CreateInstance(compiled.GetType("Callee"));
            var caller = (dynamic)Activator.CreateInstance(compiled.GetType("Caller"));

            Assert.AreEqual(TestArgumentConverter.Convert(expectedValue), caller.GetValueFromCallee(callee));
        }