示例#1
0
 public static void cannot_cast_if_a_target_method_is_missing(Test t)
 {
     t.AssertThrows <InvalidCastException>(() => Duck.Cast <ISimplist>(typeof(TargetBad)));
 }
示例#2
0
        public static void proxy_inherited_interface_types(Test t)
        {
            var proxy = Duck.Cast <IExistDeleter>(typeof(System.IO.File));

            t.Assert(true, proxy.Exists(@"c:\Windows\notepad.exe"));
        }
示例#3
0
        public static void can_call_a_void_method_with_parameter_that_returns_something(Test t)
        {
            var proxy = Duck.Cast <IAdder>(typeof(Adder));

            t.Assert(3, proxy.AddOne(2));
        }
示例#4
0
        public static void can_proxy_system_io_file(Test t)
        {
            var proxy = Duck.Cast <IExister>(typeof(System.IO.File));

            t.Assert(true, proxy.Exists(@"c:\Windows\notepad.exe"));
        }
        public static void cannot_cast_if_a_target_method_is_missing(Test t)
        {
            var target = new TargetBad();

            t.AssertThrows <InvalidCastException>(() => Duck.Cast <ISimplist>(target));
        }