コード例 #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"));
        }
コード例 #5
0
        public static void cannot_cast_if_a_target_method_is_missing(Test t)
        {
            var target = new TargetBad();

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