コード例 #1
0
        public void ContentTypeController_DeleteContentType_Throws_On_Null_ContentType()
        {
            //Arrange
            var mockDataService       = new Mock <IDataService>();
            var contentTypeController = new ContentTypeController(mockDataService.Object);

            //Act, Arrange
            Assert.Throws <ArgumentNullException>(() => contentTypeController.DeleteContentType(null));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }