Пример #1
0
        public void TestCommandRegister0()
        {
            ICallTester callTester = Substitute.For <ICallTester>();

            Command command = new Command();
            CommandRegister <ICallTester> cr = new CommandRegister <ICallTester>(command, caller => caller.Function1());

            cr.Register(0, callTester);
            command.Run("0Function1", new string[0]);
            callTester.Received(1).Function1();
            cr.Unregister(0);
        }
Пример #2
0
        public void TestCommandRegister1()
        {
            // data
            Command command = new Command();
            CommandRegister <ICallTester, int> cr = new CommandRegister <ICallTester, int>(

                command,
                (caller, arg1) => caller.Function2(arg1));
            ICallTester callTester = Substitute.For <ICallTester>();

            // test
            cr.Register(0, callTester);
            command.Run(
                "0Function2",
                new[]
            {
                "1"
            });

            // verify
            cr.Unregister(0);
        }
Пример #3
0
        public void TestCommandRegister1()
        {
            // data
            var command = new Command();
            var cr = new CommandRegister<ICallTester, int>(

                command,
                (caller, arg1) => caller.Function2(arg1));
            var callTester = Substitute.For<ICallTester>();

            // test
            cr.Register(callTester);
            command.Run(
                "Function2",
                new[]
                {
                    "1"
                });

            // verify
            cr.Unregister();
        }
Пример #4
0
        public void TestCommandRegister0()
        {
            var callTester = Substitute.For<ICallTester>();

            var command = new Command();
            var cr = new CommandRegister<ICallTester>(command, caller => caller.Function1());

            cr.Register(callTester);
            command.Run("Function1", new string[0]);
            callTester.Received(1).Function1();
            cr.Unregister();
        }