예제 #1
0
        public void AddVotePost_NotVotableDocument_Error()
        {
            var user = new User("login", new byte[0], new byte[0]);
            SetupData(x => x.Store(user));

            ExecuteAction<SharedController>(controller => controller.AddVote(user.Id, true));

            _controller.ModelState.Count.ShouldBe(1);
            _controller.ModelState[""].Errors.ShouldAllBeEquivalentTo(new ModelErrorCollection() { "Данный объект не поддерживает голосование" });
        }
예제 #2
0
 public virtual ActionResult Register(RegisterFormViewModel form)
 {
     return Handle(() =>
                       {
                           byte[] salt;
                           byte[] hash;
                           _passwordEncoder.GenerateHash(form.Password, out salt, out hash);
                           var user = new User(form.Login, salt, hash);
                           _documentSession.Store(user);
                       },
                       success: () => MVC.Home.Index());
 }