public override void Setup()
        {
            base.Setup();

            MailController = new Mock<IMailController>();
            var emailResult = new EmailResult(new Mock<IMailInterceptor>().Object, new Mock<IMailSender>().Object, new MailMessage(), "", "", Encoding.Unicode, false);
            MailController.Setup(x => x.ForgotPassword(It.IsAny<ViewModels.Mail.ForgotPassword>())).Returns(emailResult);
            MailController.Setup(x => x.Welcome(It.IsAny<ViewModels.Mail.Welcome>())).Returns(emailResult);
            UserService = new Mock<IUserService>();
            AuthenticationService = new Mock<IUserAuthenticationService>();
            AuthenticationService.Setup(x => x.ReservedUsernames).Returns(new[] { "admin" });

            Controller = new AccountController(Db, Metrics, Cache, MailController.Object, UserService.Object, AuthenticationService.Object);
            ControllerUtilities.SetupControllerContext(Controller);
        }
        /// <summary>
        /// Constructs your mail message ready for delivery.
        /// </summary>
        /// <param name="viewName">The view to use when rendering the message body.</param>
        /// <param name="model">The model object used while rendering the message body.</param>
        /// <param name="masterName">The master page to use when rendering the message body.</param>
        /// <param name="trimBody">Whether or not we should trim whitespace from the beginning and end of the message body.</param>
        /// <returns>An EmailResult that you can Deliver();</returns>
        public virtual EmailResult Email(string viewName, object model = null, string masterName = null, bool trimBody = true)
        {
            if (viewName == null)
                throw new ArgumentNullException("viewName");

            var mail = this.GenerateMail();
            var result = new EmailResult(this, MailSender, mail, viewName, masterName, MessageEncoding, trimBody);
            ViewData.Model = model;
            result.ViewData = ViewData;

            var routeData = new RouteData();
            routeData.DataTokens["area"] = FindAreaName();
            routeData.Values["controller"] = GetType().Name.Replace("Controller", string.Empty);
            routeData.Values["action"] = viewName;

            var requestContext = new RequestContext(HttpContextBase, routeData);
            ControllerContext = new ControllerContext(requestContext, this);
            try
            {
                result.ExecuteResult(ControllerContext);
            }
            catch(Exception e)
            {
            }

            return result;
        }