示例#1
0
        public void VocabularyController_DeleteVocabulary_Throws_On_Null_Vocabulary()
        {
            //Arrange
            var mockDataService      = new Mock <IDataService>();
            var vocabularyController = new VocabularyController(mockDataService.Object);

            //Act, Arrange
            Assert.Throws <ArgumentNullException>(() => vocabularyController.DeleteVocabulary(null));
        }
        public void VocabularyController_DeleteVocabulary_Throws_On_Negative_VocabularyId()
        {
            // Arrange
            var mockDataService = new Mock<IDataService>();
            var vocabularyController = new VocabularyController(mockDataService.Object);

            Vocabulary vocabulary = new Vocabulary();
            vocabulary.VocabularyId = Null.NullInteger;

            // Act, Arrange
            Assert.Throws<ArgumentOutOfRangeException>(() => vocabularyController.DeleteVocabulary(vocabulary));
        }
        public void VocabularyController_DeleteVocabulary_Clears_Vocabulary_Cache_On_Valid_Vocabulary()
        {
            // Arrange
            var mockDataService = new Mock<IDataService>();
            var vocabularyController = new VocabularyController(mockDataService.Object);

            Vocabulary vocabulary = ContentTestHelper.CreateValidVocabulary();
            vocabulary.VocabularyId = Constants.VOCABULARY_ValidVocabularyId;

            // Act
            vocabularyController.DeleteVocabulary(vocabulary);

            // Assert
            this.mockCache.Verify(cache => cache.Remove(Constants.VOCABULARY_CacheKey));
        }
        public void VocabularyController_DeleteVocabulary_Calls_DataService_On_Valid_Arguments()
        {
            // Arrange
            var mockDataService = new Mock<IDataService>();
            var vocabularyController = new VocabularyController(mockDataService.Object);

            Vocabulary vocabulary = ContentTestHelper.CreateValidVocabulary();
            vocabulary.VocabularyId = Constants.VOCABULARY_ValidVocabularyId;

            // Act
            vocabularyController.DeleteVocabulary(vocabulary);

            // Assert
            mockDataService.Verify(ds => ds.DeleteVocabulary(vocabulary));
        }
 public void DeleteVocabulary(object sender, EventArgs e)
 {
     VocabularyController.DeleteVocabulary(View.Model.Vocabulary);
     Response.Redirect(Globals.NavigateURL(TabId));
 }
示例#6
0
 public void DeleteVocabulary(Vocabulary vocabulary)
 {
     _vocabularyController.DeleteVocabulary(vocabulary);
 }