Beispiel #1
0
        public void Should_Invoke_OnCommand()
        {
            Client  expectedTarget  = new Client();
            Command expectedCommand = new SendMessageCommand();

            Client  invokedTarget  = null;
            Command invokedCommand = null;

            DomainEvents.OnCommand += (target, command) =>
            {
                invokedTarget  = target;
                invokedCommand = command;
                return(Task.CompletedTask);
            };

            DomainEvents.SendCommand(expectedTarget, expectedCommand);

            Assert.AreEqual(expectedTarget, invokedTarget);
            Assert.AreEqual(expectedCommand, invokedCommand);
        }