示例#1
0
        public void RegisterMobile_Post_RedirectedToSuccess()
        {
            // arrange
            var auth         = new Mock <IAuthenticationService>();
            var notification = new Mock <INotificationService>();
            var redirect     = new RedirectService();
            var controller   = new RegistrationController(auth.Object, notification.Object, redirect);

            // act
            var model = new RegisterUserModel()
            {
                Email           = "*****@*****.**",
                Password        = "******",
                ConfirmPassword = "******"
            };

            auth.Setup(a => a.ValidateCaptcha()).Returns(true);
            auth.Setup(a => a.RegisterNewUser("*****@*****.**", "password")).Returns(true);
            auth.Setup(a => a.Authenticate("*****@*****.**", "password")).Returns(true);

            var result = controller.RegisterMobile(model) as RedirectResult;

            // assert
            Assert.That(result.Url, Is.EqualTo("~/registration/success"));
        }