예제 #1
0
        public void ContentController_DeleteMetaData_Throws_On_Null_ContentItem()
        {
            // Arrange
            Mock <IDataService> mockDataService = new Mock <IDataService>();
            ContentController   controller      = new ContentController(mockDataService.Object);

            // Act, Arrange
            Assert.Throws <ArgumentNullException>(() => controller.AddMetaData(null, Constants.CONTENT_ValidMetaDataName, Constants.CONTENT_ValidMetaDataValue));
        }
예제 #2
0
        public void ContentController_DeleteMetaData_Throws_On_Null_MetaDataName()
        {
            // Arrange
            Mock <IDataService> mockDataService = new Mock <IDataService>();
            ContentController   controller      = new ContentController(mockDataService.Object);

            ContentItem content = ContentTestHelper.CreateValidContentItem();

            // Act, Arrange
            Assert.Throws <ArgumentOutOfRangeException>(() => controller.AddMetaData(content, Null.NullString, Constants.CONTENT_ValidMetaDataValue));
        }
예제 #3
0
        public void ContentController_AddMetaData_Throws_On_Negative_ContentItemId()
        {
            // Arrange
            Mock <IDataService> mockDataService = new Mock <IDataService>();
            ContentController   controller      = new ContentController(mockDataService.Object);

            ContentItem content = ContentTestHelper.CreateValidContentItem();

            content.ContentItemId = Null.NullInteger;

            // Act, Arrange
            Assert.Throws <ArgumentOutOfRangeException>(() => controller.AddMetaData(content, Constants.CONTENT_ValidMetaDataName, Constants.CONTENT_ValidMetaDataValue));
        }
예제 #4
0
        public void ContentController_AddMetaData_Calls_DataService_On_Valid_Arguments()
        {
            // Arrange
            Mock <IDataService> mockDataService = new Mock <IDataService>();
            ContentController   controller      = new ContentController(mockDataService.Object);

            ContentItem content = ContentTestHelper.CreateValidContentItem();

            content.ContentItemId = Constants.CONTENT_ValidContentItemId;

            // Act
            controller.AddMetaData(content, Constants.CONTENT_ValidMetaDataName, Constants.CONTENT_ValidMetaDataValue);

            // Assert
            mockDataService.Verify(ds => ds.AddMetaData(content, Constants.CONTENT_ValidMetaDataName, Constants.CONTENT_ValidMetaDataValue));
        }