public void Map_EmptyDataArray_ThrowsScraperException()
        {
            // Arrange
            var resource = new Resource { Data = new Data[0] };

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }
        public void Map_AssetsArrayWithoutVideoResourceAsset_ThrowsScraperException()
        {
            // Arrange
            var assetMock = new Mock<IAsset>();
            var resource = new Resource
                               {
                                   Data = new[] { new Data { Assets = new[] { assetMock.Object } } }
                               };

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }
        public void Map_LinksArrayWithoutStreamingLink_ThrowsScraperException()
        {
            // Arrange
            var resource = new Resource
                               {
                                   Data = new[] { new Data { Assets = new IAsset[] { new VideoResourceAsset { Links = new[] { new Link() } } } } }
                               };

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }
        public void Map_EmptyLinksArray_ThrowsScraperException()
        {
            // Arrange
            var resource = new Resource
                               {
                                   Data = new[] { new Data { Assets = new IAsset[] { new VideoResourceAsset { Links = new Link[0] } } } }
                               };

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }
        public void Map_ValidResource_CallsProgramFactory()
        {
            // Arrange
            var resource = new Resource
                               {
                                   Data = new[] { new Data { Assets = new IAsset[] { new VideoResourceAsset { Links = new[] { new Link { Target = "Streaming", Uri = "http://www.rtmp-uri.dk" } } } } } }
                               };

            // Act
            var program = _resourceMapper.Map(resource);

            // Assert
            Assert.NotNull(program);
        }
        public void Map_NullLinksProperty_ThrowsScraperException()
        {
            // Arrange
            var resource = new Resource
                               {
                                   Data = new[] { new Data { Assets = new IAsset[] { new VideoResourceAsset() } } }
                               };

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }
        public void Map_NullDataProperty_ThrowsScraperException()
        {
            // Arrange
            var resource = new Resource();

            // Act and assert.
            Assert.Throws<ScraperException>(() => _resourceMapper.Map(resource));
        }