예제 #1
0
        public void Behavior_should_not_be_calling_validate_in_the_ValidationConfiguration()
        {
            var testViewModel = new TestViewModelNotImplementingICanBeValidated();

            var mock = MockRepository.GenerateStub<IValidate>();
            mock.Expect(x => x.Validate(testViewModel)).Return(new ValidationResults<TestViewModelNotImplementingICanBeValidated>());
            var sut = new validate_input_view_model_using_convention_based_validation_rules_server_side(mock);

            sut.PrepareInput(testViewModel);

            mock.AssertWasNotCalled(x => x.Validate(new TestViewModel()), o => o.IgnoreArguments());
        }
예제 #2
0
        public void Behavior_should_be_calling_validate_in_the_ValidationConfiguration()
        {
            var testViewModel = new TestViewModel();

            var mock = MockRepository.GenerateStub<IValidate>();
            mock.Expect(x => x.Validate(testViewModel)).Return(new ValidationResults<TestViewModel>());
            var sut = new validate_input_view_model_using_convention_based_validation_rules_server_side(mock);

            sut.PrepareInput(testViewModel);

            mock.VerifyAllExpectations();
        }
예제 #3
0
        public void Behavior_should_not_be_calling_validate_in_the_ValidationConfiguration()
        {
            var testViewModel = new TestViewModelNotImplementingICanBeValidated();

            var mock = MockRepository.GenerateStub <IValidate>();

            mock.Expect(x => x.Validate(testViewModel)).Return(new ValidationResults <TestViewModelNotImplementingICanBeValidated>());
            var sut = new validate_input_view_model_using_convention_based_validation_rules_server_side(mock);

            sut.PrepareInput(testViewModel);

            mock.AssertWasNotCalled(x => x.Validate(new TestViewModel()), o => o.IgnoreArguments());
        }
예제 #4
0
        public void Behavior_should_be_calling_validate_in_the_ValidationConfiguration()
        {
            var testViewModel = new TestViewModel();

            var mock = MockRepository.GenerateStub <IValidate>();

            mock.Expect(x => x.Validate(testViewModel)).Return(new ValidationResults <TestViewModel>());
            var sut = new validate_input_view_model_using_convention_based_validation_rules_server_side(mock);

            sut.PrepareInput(testViewModel);

            mock.VerifyAllExpectations();
        }