Example #1
0
        public IHttpActionResult SendRegistrationEMail(SendRegistrationEmailCommand cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException("SendRegistrationEmailCommand");
            }

            _commandDispatcher.Dispatch(cmd);

            return Ok();
        }
        public void Given_Portal_User_Exists_when_Send_Registration_Email_is_called_then_registration_link_is_sent_in_email()
        {
            SendRegistrationEmailCommand dispatchedCmd = null;
            _mockCommandDispatcher
                .Setup(q => q.Dispatch(It.IsAny<SendRegistrationEmailCommand>()))
                .Callback<SendRegistrationEmailCommand>(c => dispatchedCmd = c);

            var controller = GetTarget();

            SendRegistrationEmailCommand cmd = new SendRegistrationEmailCommand() { Email = "*****@*****.**" };
            var actionResult = controller.SendRegistrationEMail(cmd);

            Assert.IsInstanceOf<OkResult>(actionResult);

            Assert.AreEqual(cmd.Email, dispatchedCmd.Email);
        }