Code example - test class for the Youtube Info library

  1. using System.Linq;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. namespace YoutubeInfo.LocalTests
  4. {
  5.     [TestClass]
  6.     public class YoutubeInfoTests
  7.     {
  8.         private const string YoutubeUrl = "https://www.youtube.com/watch?v=90K_G4hyxCk";
  9.         [TestMethod]
  10.         public void TestFlvUrl()
  11.         {
  12.             // assign
  13.             var vi = new global::YoutubeInfo.YoutubeInfo();
  14.             // act
  15.             var links = vi.GetFlvVideos(YoutubeUrl);
  16.             //assert
  17.             Assert.IsTrue(links.Any());
  18.         }
  19.         [TestMethod]
  20.         public void TestMp4Url()
  21.         {
  22.             // assign
  23.             var vi = new global::YoutubeInfo.YoutubeInfo();
  24.             // act
  25.             var links = vi.GetMp4Videos(YoutubeUrl);
  26.             //assert
  27.             Assert.IsTrue(links.Any());
  28.         }
  29.     }
  30. }

NuGet package: YouTube Video Information