Beispiel #1
0
        public void ToMapWithMissingMethods()
        {
            var instance = new CommandInstance();

            var mapper = CommandMapper <ICommandInterface> .Create();

            mapper.From(c => c.InterfaceMethod())
            .To(() => instance.InstanceMethod());

            Assert.Throws <CommandMethodNotMappedException>(() => mapper.ToMap());
        }
Beispiel #2
0
        private static CommandMap CreateCommandMap()
        {
            var instance = new CommandInstance();

            var mapper = CommandMapper <ICommandInterface> .Create();

            mapper.From(c => c.InterfaceMethod())
            .To(() => instance.InstanceMethod());
            mapper.From <int>((c, p1) => c.InterfaceMethod(p1))
            .To <int>(p1 => instance.InstanceMethod(p1));
            mapper.From <int, int>((c, p1, p2) => c.InterfaceMethod(p1, p2))
            .To <int, int>((p1, p2) => instance.InstanceMethod(p1, p2));
            mapper.From <int, int, int>((c, p1, p2, p3) => c.InterfaceMethod(p1, p2, p3))
            .To <int, int, int>((p1, p2, p3) => instance.InstanceMethod(p1, p2, p3));
            mapper.From <int, int, int, int>((c, p1, p2, p3, p4) => c.InterfaceMethod(p1, p2, p3, p4))
            .To <int, int, int, int>((p1, p2, p3, p4) => instance.InstanceMethod(p1, p2, p3, p4));
            mapper.From <int, int, int, int, int>((c, p1, p2, p3, p4, p5) => c.InterfaceMethod(p1, p2, p3, p4, p5))
            .To <int, int, int, int, int>((p1, p2, p3, p4, p5) => instance.InstanceMethod(p1, p2, p3, p4, p5));
            mapper.From <int, int, int, int, int, int>((c, p1, p2, p3, p4, p5, p6) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6))
            .To <int, int, int, int, int, int>((p1, p2, p3, p4, p5, p6) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6));
            mapper.From <int, int, int, int, int, int, int>((c, p1, p2, p3, p4, p5, p6, p7) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7))
            .To <int, int, int, int, int, int, int>((p1, p2, p3, p4, p5, p6, p7) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7));
            mapper.From <int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8))
            .To <int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8));
            mapper.From <int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9))
            .To <int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9));
            mapper.From <int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))
            .To <int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))
            .To <int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))
            .To <int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14));
            mapper.From <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (c, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) =>
                c.InterfaceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15))
            .To <int, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(
                (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) =>
                instance.InstanceMethod(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15));

            return(mapper.ToMap());
        }