Ejemplo n.º 1
0
        public void DynamicInvokeMember()
        {
            dynamic d   = new DynamicallyInvokableIntPowerMember();
            int     pow = d.Power(8, 9);

            Assert.Equal(134217728, pow);
            Assert.Throws <OverflowException>(() => d.Power(int.MaxValue, int.MaxValue));
        }
Ejemplo n.º 2
0
        public void DynamicInvokeMemberMismatch()
        {
            dynamic d = new DynamicallyInvokableIntPowerMember();

            Assert.Throws <RuntimeBinderException>(() => d.Power(9));
            Assert.Throws <RuntimeBinderException>(() => d.Power());
            Assert.Throws <RuntimeBinderException>(() => d.Power(1, 2, 3));
            Assert.Throws <RuntimeBinderException>(() => d.Power("eight", "nine"));
            Assert.Throws <RuntimeBinderException>(() => d.power(8, 9));
        }
Ejemplo n.º 3
0
 public void DynamicInvokeMemberMismatch()
 {
     dynamic d = new DynamicallyInvokableIntPowerMember();
     Assert.Throws<RuntimeBinderException>(() => d.Power(9));
     Assert.Throws<RuntimeBinderException>(() => d.Power());
     Assert.Throws<RuntimeBinderException>(() => d.Power(1, 2, 3));
     Assert.Throws<RuntimeBinderException>(() => d.Power("eight", "nine"));
     Assert.Throws<RuntimeBinderException>(() => d.power(8, 9));
 }
Ejemplo n.º 4
0
 public void DynamicInvokeMemberStaticMember()
 {
     dynamic d = new DynamicallyInvokableIntPowerMember();
     int mod = d.Modulo(233, 12);
     Assert.Equal(5, mod);
     Assert.Throws<RuntimeBinderException>(() => d.Modulo(2));
     Assert.Throws<RuntimeBinderException>(() => d.modulo(233, 12));
     Assert.Throws<RuntimeBinderException>(() => d.Modulo());
     Assert.Throws<RuntimeBinderException>(() => d.Modulo(233, 12, 9));
     Assert.Throws<RuntimeBinderException>(() => d.Modulo("two hundred and thirty-three", "twelve"));
 }
Ejemplo n.º 5
0
 public void DynamicInvokeMember()
 {
     dynamic d = new DynamicallyInvokableIntPowerMember();
     int pow = d.Power(8, 9);
     Assert.Equal(134217728, pow);
     Assert.Throws<OverflowException>(() => d.Power(int.MaxValue, int.MaxValue));
 }