Skip to content

Commit

Permalink
[Tests] Minor test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Sep 13, 2022
1 parent 9d84864 commit 99bdbd6
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions CastIt.Youtube.UnitTest/YoutubeUrlDecoderTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CastIt.Domain.Exceptions;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -110,20 +112,44 @@ public async Task ParseBasicInfo_ValidUrl_ReturnsBasicInfo(string url)
info.IsHls.ShouldBeFalse();
}

[Theory]
[InlineData("https://www.youtube.com/watch?v=8NzYo0jmYek")]
[InlineData("https://www.youtube.com/watch?v=uUBfbLdXArA")]
public async Task ParseBasicInfo_ValidHlsUrl_ReturnsBasicInfo(string url)
[Fact]
public async Task ParseBasicInfo_ValidHlsUrl_ReturnsBasicInfo()
{
//Arrange
var urls = new Dictionary<string, string>
{
{"TN EN VIVO", "https://www.youtube.com/watch?v=wHn1_QVoXGM"},
{"lofi hip hop radio", "https://www.youtube.com/watch?v=jfKfPfyJRdk"},
{"Noticias EN VIVO | Milenio Noticias", "https://www.youtube.com/watch?v=UWNlpWsNS4M"},
{"Noticias 24/7 FOROtv", "https://www.youtube.com/watch?v=prpSI_M_rSA"},
{"MULTIMEDIOS", "https://www.youtube.com/watch?v=Yspuna_xKFw"},
{"Sky News", "https://www.youtube.com/watch?v=9Auq9mYxFEE"},
{"euronews", "https://www.youtube.com/watch?v=JbKgQhFlMdU"},
{"Al Jazeera", "https://www.youtube.com/watch?v=F-POY4Q0QSI"},
{"DW", "https://www.youtube.com/watch?v=RTjbYKBB828"},
{"Meganoticias", "https://www.youtube.com/watch?v=f7_om6wwnps"}
};
var decoder = GetService();

//Act
var info = await decoder.ParseBasicInfo(url);
var finalUrls = new List<string>();
foreach (var kvp in urls)
{
try
{
var info = await decoder.ParseBasicInfo(kvp.Value);
CheckBasicInfo(info, false);
info.IsHls.ShouldBeTrue();
finalUrls.Add(info.Url);
}
catch (Exception)
{
// ignored
}
}

//Assert
CheckBasicInfo(info, false);
info.IsHls.ShouldBeTrue();
finalUrls.Count.ShouldBeGreaterThan(0);
}

[Theory]
Expand Down

0 comments on commit 99bdbd6

Please sign in to comment.