コード例 #1
0
 public void FunctionWithArgTest()
 {
     var genericTestArg = new TestArg();
     Func<TestArg, TestClass> functionWithArg = TestClassConverter;
     var result = functionWithArg(genericTestArg);
     Assert.AreEqual(genericTestArg, result.Arg);
 }
コード例 #2
0
 public void ConverterTest()
 {
     var genericTestArg = new TestArg();
     Converter<TestArg, TestClass> convertTestArgToTestClass = TestClassConverter;
     var result = convertTestArgToTestClass(genericTestArg);
     Assert.AreEqual(genericTestArg, result.Arg);
 }
コード例 #3
0
 public void ActionWithArgTest()
 {
     TestArg testGenericDelegateArg = null;
     var genericTestArg = new TestArg();
     Action<TestArg> actionWithTestArg = a => testGenericDelegateArg = a;
     actionWithTestArg(genericTestArg);
     Assert.AreEqual(genericTestArg, testGenericDelegateArg);
 }
コード例 #4
0
 public void ConverterTest()
 {
     var converterExecuted = false;
     var genericTestArg = new TestArg();
     Converter<TestArg, TestClass> convertTestArgToTestClass = a =>
     {
         converterExecuted = true;
         return new TestClass{Arg = a};
     };
     var result = convertTestArgToTestClass(genericTestArg);
     Assert.AreEqual(genericTestArg, result.Arg);
     Assert.IsTrue(converterExecuted);
 }
コード例 #5
0
 public void BaseMemberAccess_BindTestMethod_BaseClass()
 {
     var arg = new TestArg() as BaseTestArg;
     engine.AddRestrictedHostObject("arg", arg);
     Assert.AreEqual(testObject.BaseBindTestMethod(arg), engine.Evaluate("testObject.BaseBindTestMethod(arg)"));
 }
コード例 #6
0
 public void BaseMemberAccess_ExtensionBindTestMethod_Interface()
 {
     var arg = new TestArg() as ITestArg;
     engine.AddRestrictedHostObject("arg", arg);
     Assert.AreEqual(testObject.BaseExtensionBindTestMethod(arg), engine.Evaluate("testObject.BaseExtensionBindTestMethod(arg)"));
 }
 public void ExplicitBaseInterfaceMemberAccess_ExtensionBindTestMethod_BaseClass()
 {
     var arg = new TestArg() as BaseTestArg;
     engine.AddRestrictedHostObject("arg", arg);
     Assert.AreEqual(testInterface.ExplicitBaseInterfaceExtensionBindTestMethod(arg), engine.Evaluate("testInterface.ExplicitBaseInterfaceExtensionBindTestMethod(arg)"));
 }
コード例 #8
0
 public void FunctionWithArgTest()
 {
     var functionExecuted = false;
     var genericTestArg = new TestArg();
     Func<TestArg, TestClass> functionWithArg = a =>
     {
         functionExecuted = true;
         return new TestClass{Arg = a};
     };
     var result = functionWithArg(genericTestArg);
     Assert.AreEqual(genericTestArg, result.Arg);
     Assert.IsTrue(functionExecuted);
 }
 public void ExplicitInterfaceMemberAccess_BindTestMethod_Interface()
 {
     var arg = new TestArg() as ITestArg;
     engine.AddRestrictedHostObject("arg", arg);
     Assert.AreEqual(testInterface.ExplicitInterfaceBindTestMethod(arg), engine.Evaluate("testInterface.ExplicitInterfaceBindTestMethod(arg)"));
 }
コード例 #10
0
 public void StaticMemberAccess_BindTestMethod_Interface()
 {
     var arg = new TestArg() as ITestArg;
     engine.AddRestrictedHostObject("arg", arg);
     Assert.AreEqual(StaticTestClass.StaticBindTestMethod(arg), engine.Evaluate("StaticTestClass.StaticBindTestMethod(arg)"));
 }
コード例 #11
0
 TestClass TestClassConverter(TestArg arg)
 {
     return new TestClass {Arg = arg};
 }
コード例 #12
0
 void MyActionWithArg(TestArg arg)
 {
     testGenericDelegateArg = arg;
 }