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_DeleteContentType_Throws_On_Negative_ContentTypeId() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); ContentType contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentTypeId = Null.NullInteger; //Act, Arrange Assert.Throws <ArgumentOutOfRangeException>(() => contentTypeController.DeleteContentType(contentType)); }
public void ContentTypeController_AddContentType_Calls_DataService_On_Valid_Arguments() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); ContentType contentType = ContentTestHelper.CreateValidContentType(); //Act int contentTypeId = contentTypeController.AddContentType(contentType); //Assert mockDataService.Verify(ds => ds.AddContentType(contentType)); }
public void ContentTypeController_AddContentType_Returns_ValidId_On_Valid_ContentType() { //Arrange var mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.AddContentType(It.IsAny <ContentType>())).Returns(Constants.CONTENTTYPE_AddContentTypeId); var contentTypeController = new ContentTypeController(mockDataService.Object); var contentType = ContentTestHelper.CreateValidContentType(); //Act int contentTypeId = contentTypeController.AddContentType(contentType); //Assert Assert.AreEqual(Constants.CONTENTTYPE_AddContentTypeId, contentTypeId); }
public void ContentTypeController_DeleteContentType_Calls_DataService_On_Valid_ContentTypeId() { //Arrange var mockDataService = new Mock <IDataService>(); var contentTypeController = new ContentTypeController(mockDataService.Object); var contentType = ContentTestHelper.CreateValidContentType(); contentType.ContentTypeId = Constants.CONTENTTYPE_ValidContentTypeId; //Act contentTypeController.DeleteContentType(contentType); //Assert mockDataService.Verify(ds => ds.DeleteContentType(contentType)); }