Exemplo n.º 1
0
        public async Task <IActionResult> GetVideoMetaData(string videoUrl)
        {
            VideoDetails details;

            try
            {
                details = await clientHelper.GetVideoMetadataAsync(clientHelper.GetVideoID(videoUrl));
            }
            catch (FormatException)
            {
                return(BadRequest("Provided URL is incorrect"));
            }
            return(Ok(details));
        }
Exemplo n.º 2
0
        public async Task GetVideoMetadata_CanExtractMetadata(params string[] videoIds)
        {
            //Arrange
            VideoDetails[] results = new VideoDetails[videoIds.Length];
            //Act
            for (int i = 0; i < videoIds.Length; i++)
            {
                results[i] = await target.GetVideoMetadataAsync(videoIds[i]);
            }

            //Assert
            Assert.Equal("4K VIDEO ultrahd hdr sony 4K VIDEOS demo test nature relaxation movie for 4k oled tv", results[0].Title);
            Assert.Equal("LoungeV Films - Relaxing Music and Nature Sounds", results[1].ChannelName);


            List <string> actualQualities   = results[0].qualities.ToList();
            List <string> expectedQualities = new List <string>()
            {
                "144p", "240p", "360p", "480p", "720p", "1080p", "1440p", "2160p"
            };

            Assert.True(Enumerable.SequenceEqual(actualQualities.OrderBy(x => x), expectedQualities.OrderBy(x => x)));
        }