public void TermController_DeleteTerm_Throws_On_Null_Term() { //Arrange var mockDataService = new Mock <IDataService>(); var termController = new TermController(mockDataService.Object); //Act, Arrange Assert.Throws <ArgumentNullException>(() => termController.DeleteTerm(null)); }
public static void DeleteTerm(int termId) { var termCtrl = new TermController(); var term = termCtrl.GetTerm(termId); if (term != null) { termCtrl.DeleteTerm(term); } }
public void TermController_DeleteTerm_Throws_On_Negative_TermId() { //Arrange var mockDataService = new Mock <IDataService>(); var termController = new TermController(mockDataService.Object); var term = ContentTestHelper.CreateValidSimpleTerm(Constants.VOCABULARY_ValidVocabularyId); term.TermId = Null.NullInteger; //Act, Arrange Assert.Throws <ArgumentOutOfRangeException>(() => termController.DeleteTerm(term)); }
public void TermController_DeleteTerm_Should_Call_DataService_DeleteHeirarchicalTerm_If_Term_Is_Heirarchical_Term() { //Arrange var mockDataService = new Mock <IDataService>(); var termController = new TermController(mockDataService.Object); var term = ContentTestHelper.CreateValidHeirarchicalTerm(Constants.VOCABULARY_HierarchyVocabularyId, Constants.TERM_ValidParentTermId); term.TermId = Constants.TERM_DeleteTermId; // Act termController.DeleteTerm(term); // Assert mockDataService.Verify(ds => ds.DeleteHeirarchicalTerm(term)); }
public void TermController_DeleteTerm_Clears_Term_Cache_On_Valid_Term() { //Arrange var mockDataService = new Mock <IDataService>(); var termController = new TermController(mockDataService.Object); var term = new Term(Constants.VOCABULARY_ValidVocabularyId) { TermId = Constants.TERM_DeleteTermId }; //Act termController.DeleteTerm(term); //Assert mockCache.Verify(cache => cache.Remove(String.Format(Constants.TERM_CacheKey, Constants.VOCABULARY_ValidVocabularyId))); }
public void DeleteTerm(object sender, EventArgs e) { TermController.DeleteTerm(View.Model.Term); RefreshTerms(); }
public void DeleteTerm(Term term) { _termController.DeleteTerm(term); }