public void CreateVocabularyPresenter_SaveVocabulary_Validates_Vocabulary()
        {
            // Arrange
            Mock<ICreateVocabularyView> mockView = new Mock<ICreateVocabularyView>();
            CreateVocabularyModel model = new CreateVocabularyModel
                                              {
                                                  Vocabulary = new Vocabulary
                                                                   {
                                                                       VocabularyId = Null.NullInteger,
                                                                       ScopeTypeId = 1
                                                                   }
                                              };
            mockView.Setup(v => v.Model).Returns(model);

            CreateVocabularyPresenter presenter = CreatePresenter(mockView);

            Mock<ObjectValidator> mockValidator = MockHelper.EnableValidMockValidator(presenter.Validator,
                                                                                      model.Vocabulary);

            // Act
            mockView.Raise(v => v.Save += null, EventArgs.Empty);

            // Assert
            mockValidator.Verify(v => v.ValidateObject(model.Vocabulary));
        }
        public void CreateVocabularyPresenter_SaveVocabulary_Does_Not_Save_If_Vocabulary_Invalid()
        {
            Mock<ICreateVocabularyView> mockView = new Mock<ICreateVocabularyView>();
            CreateVocabularyModel model = new CreateVocabularyModel
                                              {
                                                  Vocabulary = new Vocabulary
                                                                   {
                                                                       VocabularyId = Null.NullInteger,
                                                                       ScopeTypeId = 1
                                                                   }
                                              };
            mockView.Setup(v => v.Model).Returns(model);

            CreateVocabularyPresenter presenter = CreatePresenter(mockView);

            Mock<ObjectValidator> mockValidator = MockHelper.EnableInvalidMockValidator(presenter.Validator,
                                                                                        model.Vocabulary);

            // Act (Raise the Save Event)
            mockView.Raise(v => v.Save += null, EventArgs.Empty);

            // Assert
            Mock.Get(presenter.VocabularyController)
                .Verify(r => r.UpdateVocabulary(model.Vocabulary), Times.Never());
        }