示例#1
0
        public void TestCacheableDoNotExposePrivateMethod()
        {
            var tTest         = new TestWithPrivateMethod();
            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Test");

            AssertException <RuntimeBinderException>(() => tCachedInvoke.Invoke(tTest));
        }
示例#2
0
        public void TestCacheableExposePrivateMethodViaType()
        {
            var tTest         = new TestWithPrivateMethod();
            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Test", context: typeof(TestWithPrivateMethod));

            Assert.AreEqual(3, tCachedInvoke.Invoke(tTest));
        }
示例#3
0
        public void TestDoNotExposePrivateMethod()
        {
            var tTest       = new TestWithPrivateMethod();
            var tNonExposed = tTest.WithContext(this).ActLike <IExposePrivateMethod>();

            AssertException <RuntimeBinderException>(() => tNonExposed.Test());
        }
示例#4
0
        public void TestExposePrivateMethod()
        {
            var tTest    = new TestWithPrivateMethod();
            var tExposed = tTest.ActLike <IExposePrivateMethod>();

            Assert.AreEqual(3, tExposed.Test());
        }
 public void TestCacheableExposePrivateMethodViaType()
 {
     var tTest = new TestWithPrivateMethod();
     var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Test", context:typeof(TestWithPrivateMethod));
     Assert.AreEqual(3, tCachedInvoke.Invoke(tTest)); 
 }
 public void TestCacheableDoNotExposePrivateMethod()
 {
     var tTest = new TestWithPrivateMethod();
     var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, "Test");
     AssertException<RuntimeBinderException>(() => tCachedInvoke.Invoke(tTest));
 }
 public void TestInvokeDoNotExposePrivateMethod()
 {
     var tTest = new TestWithPrivateMethod();
     AssertException<RuntimeBinderException>(() => Impromptu.InvokeMember(tTest.WithContext(this), "Test"));
 }
 public void TestInvokePrivateMethod()
 {
     var tTest = new TestWithPrivateMethod();
     Assert.AreEqual(3, Impromptu.InvokeMember(tTest,"Test"));
 }
 public void TestDoNotExposePrivateMethod()
 {
     var tTest = new TestWithPrivateMethod();
     var tNonExposed = tTest.WithContext(this).ActLike<IExposePrivateMethod>();
     AssertException<RuntimeBinderException>(() => tNonExposed.Test());
 }
 public void TestExposePrivateMethod()
 {
     var tTest = new TestWithPrivateMethod();
     var tExposed = tTest.ActLike<IExposePrivateMethod>();
     Assert.AreEqual(3, tExposed.Test()); 
 }
示例#11
0
        public void TestInvokeDoNotExposePrivateMethod()
        {
            var tTest = new TestWithPrivateMethod();

            AssertException <RuntimeBinderException>(() => Impromptu.InvokeMember(tTest.WithContext(this), "Test"));
        }
示例#12
0
        public void TestInvokePrivateMethod()
        {
            var tTest = new TestWithPrivateMethod();

            Assert.AreEqual(3, Impromptu.InvokeMember(tTest, "Test"));
        }
        public void TestInvokeDoNotExposePrivateMethod()
        {
            var tTest = new TestWithPrivateMethod();

            AssertException <RuntimeBinderException>(() => Dynamic.InvokeMember(new InvokeContext(tTest, this), "Test"));
        }