示例#1
0
        public void DynamicInvoke()
        {
            dynamic d   = new DynamicallyInvokableIntPower();
            int     pow = d(8, 9);

            Assert.Equal(134217728, pow);
            Assert.Throws <OverflowException>(() => d(int.MaxValue, int.MaxValue));
        }
示例#2
0
        public void DynamicInvokeMismatch()
        {
            dynamic d = new DynamicallyInvokableIntPower();

            Assert.Throws <RuntimeBinderException>(() => d(9));
            Assert.Throws <RuntimeBinderException>(() => d());
            Assert.Throws <RuntimeBinderException>(() => d(1, 2, 3));
            Assert.Throws <RuntimeBinderException>(() => d("eight", "nine"));
        }
示例#3
0
 public void DynamicInvokeMismatch()
 {
     dynamic d = new DynamicallyInvokableIntPower();
     Assert.Throws<RuntimeBinderException>(() => d(9));
     Assert.Throws<RuntimeBinderException>(() => d());
     Assert.Throws<RuntimeBinderException>(() => d(1, 2, 3));
     Assert.Throws<RuntimeBinderException>(() => d("eight", "nine"));
 }
示例#4
0
 public void DynamicInvoke()
 {
     dynamic d = new DynamicallyInvokableIntPower();
     int pow = d(8, 9);
     Assert.Equal(134217728, pow);
     Assert.Throws<OverflowException>(() => d(int.MaxValue, int.MaxValue));
 }