public void should_require_old_password_and_new_password()
        {
            var viewModel = new ChangePasswordViewModel();

            var modelState = _app.ValidateModel(viewModel);

            Assert.False(modelState.IsValid);
            modelState.Keys.ShouldContain("OldPassword");
            modelState.Keys.ShouldContain("NewPassword");
        }
        public void should_validate_normal_username_and_password_values_as_valid()
        {
            var modelState = _app.ValidateModel(
                new UserViewModel
            {
                UserName = "******",
                Password = "******"
            });

            Assert.True(modelState.IsValid);
            modelState.Keys.ShouldNotContain("UserName");
            modelState.Keys.ShouldNotContain("Password");
        }
Esempio n. 3
0
        private ModelStateDictionary ValidateTopic(string title, string content, TopicType?type = TopicType.Discussion)
        {
            var createModel = new TopicCreationModel {
                Title = title, Content = content, Type = type
            };

            return(_app.ValidateModel(createModel));
        }
        public void should_validate_empty_content_as_invalid()
        {
            var replyModel = new ReplyCreationModel();

            var modelState = _app.ValidateModel(replyModel);

            Assert.False(modelState.IsValid);
        }