public void MessageTypeToProcess()
        {
            var         endpoint          = new EndpointId("id");
            SendMessage sendAction        = (e, m, r) => { };
            var         commands          = new Mock <ICommandCollection>();
            var         systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);

            var action = new CommandInvokedProcessAction(endpoint, sendAction, commands.Object, systemDiagnostics);

            Assert.AreEqual(typeof(CommandInvokedMessage), action.MessageTypeToProcess);
        }
        public void InvokeWithTaskReturn()
        {
            var actionObject = new Mock <IMockCommandSet>();
            {
                actionObject.Setup(a => a.MethodWithoutReturnValue(It.IsAny <int>()))
                .Verifiable();
            }

            var commandIds = new List <CommandId>
            {
                CommandId.Create(typeof(IMockCommandSet).GetMethod("MethodWithoutReturnValue")),
            };
            var commandSets = new List <CommandDefinition>
            {
                new CommandDefinition(
                    commandIds[0],
                    new[]
                {
                    new CommandParameterDefinition(
                        typeof(int),
                        "someNumber",
                        CommandParameterOrigin.FromCommand),
                },
                    false,
                    (Action <int>)actionObject.Object.MethodWithoutReturnValue)
            };

            var endpoint = new EndpointId("id");

            ICommunicationMessage storedMsg  = null;
            SendMessage           sendAction =
                (e, m, r) =>
            {
                storedMsg = m;
            };
            var commands = new Mock <ICommandCollection>();
            {
                commands.Setup(c => c.CommandToInvoke(It.IsAny <CommandId>()))
                .Returns(commandSets[0]);
                commands.Setup(c => c.GetEnumerator())
                .Returns(commandIds.GetEnumerator());
            }

            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);

            var action = new CommandInvokedProcessAction(endpoint, sendAction, commands.Object, systemDiagnostics);

            action.Invoke(
                new CommandInvokedMessage(
                    new EndpointId("otherId"),
                    new CommandInvokedData(
                        commandIds[0],
                        new[]
            {
                new CommandParameterValueMap(
                    new CommandParameterDefinition(typeof(int), "someNumber", CommandParameterOrigin.FromCommand),
                    2),
            })));

            actionObject.Verify(a => a.MethodWithoutReturnValue(It.IsAny <int>()), Times.Once());
            Assert.IsInstanceOf <SuccessMessage>(storedMsg);
        }