mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
unit tests
This commit is contained in:
parent
a1e0042966
commit
e5cc355dfe
2 changed files with 41 additions and 1 deletions
41
src/Ombi.Helpers.Tests/HtmlHelperTests.cs
Normal file
41
src/Ombi.Helpers.Tests/HtmlHelperTests.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ombi.Helpers.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class HtmlHelperTests
|
||||
{
|
||||
[TestCaseSource(nameof(HtmlData))]
|
||||
public string RemoveHtmlTests(string input)
|
||||
{
|
||||
return HtmlHelper.RemoveHtml(input);
|
||||
}
|
||||
|
||||
public static IEnumerable<TestCaseData> HtmlData
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new TestCaseData("<h1>hi</h1>").Returns("hi").SetName("Simple Html");
|
||||
yield return new TestCaseData("<html><body><head></head><h1>hi</h1></body></html>").Returns("hi").SetName("Nested text inside Html");
|
||||
yield return new TestCaseData("there is no html here").Returns("there is no html here").SetName("No Html");
|
||||
yield return new TestCaseData("there is <b>some</b> html here").Returns("there is some html here").SetName("Html in middle");
|
||||
yield return new TestCaseData("<a>there</a> <u>is</u> <b>lots</b> <i>html</i> <span>here</span>").Returns("there is lots html here").SetName("Html in everywhere");
|
||||
yield return new TestCaseData("there is <span class=\"abc\">some</span> html here").Returns("there is some html here").SetName("Html in with classes");
|
||||
yield return new TestCaseData("there is <span id=\"sometag\">some</span> html here").Returns("there is some html here").SetName("Html in with attribute");
|
||||
yield return new TestCaseData("there is <span data-tag=\"sometag\" class=\"abc\">some</span> html here").Returns("there is some html here").SetName("Html in with attribute and class");
|
||||
}
|
||||
}
|
||||
public static IEnumerable<TestCaseData> OtherData
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var data in HtmlData)
|
||||
{
|
||||
yield return data;
|
||||
}
|
||||
yield return new TestCaseData("xyz").Returns("xyz").SetName("More Tests");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,5 @@ namespace Ombi.Helpers
|
|||
var step2 = Regex.Replace(step1, @"\s{2,}", " ");
|
||||
return step2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue