File size: 864 Bytes
fab29d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
using VersOne.Epub.Internal;
namespace VersOne.Epub.Test.Unit.Utils
{
public class UrlParserTests
{
[Theory(DisplayName = "Parsing URLs with or without anchor should succeed")]
[InlineData("file.html#anchor", "file.html", "anchor")]
[InlineData("file.html", "file.html", null)]
public void ConstructorWithNonNullUrlTest(string url, string expectedPath, string? expectedAnchor)
{
UrlParser urlParser = new(url);
Assert.Equal(expectedPath, urlParser.Path);
Assert.Equal(expectedAnchor, urlParser.Anchor);
}
[Fact(DisplayName = "Constructor should throw an ArgumentNullException if URL parameter is null")]
public void ConstructorWithNullUrlTest()
{
Assert.Throws<ArgumentNullException>(() => new UrlParser(null!));
}
}
}
|