public void ContentTypeController_UpdateContentType_Throws_On_Null_ContentType() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); //Act, Arrange Assert.Throws <ArgumentNullException>(() => contentTypeController.UpdateContentType(null)); }
public void ContentTypeController_UpdateContentType_Throws_On_Negative_ContentTypeId() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); var contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentType = Constants.CONTENTTYPE_InValidContentType; Assert.Throws <ArgumentOutOfRangeException>(() => contentTypeController.UpdateContentType(contentType)); }
public void ContentTypeController_UpdateContentType_Calls_DataService_On_Valid_ContentType() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); var contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentTypeId = Constants.CONTENTTYPE_UpdateContentTypeId; contentType.ContentType = Constants.CONTENTTYPE_UpdateContentType; //Act contentTypeController.UpdateContentType(contentType); //Assert mockDataService.Verify(ds => ds.UpdateContentType(contentType)); }