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 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 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_Throws_On_Null_Vocabulary() { //Arrange Mock<IDataService> mockDataService = new Mock<IDataService>(); VocabularyController vocabularyController = new VocabularyController(mockDataService.Object); //Act, Arrange AutoTester.ArgumentNull<Vocabulary>(marker => vocabularyController.DeleteVocabulary(marker)); }