added test

This commit is contained in:
Nicolas Constant 2021-02-02 00:27:48 -05:00
parent 0c6ee3dd4d
commit 25d1f360ba
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688

View file

@ -289,6 +289,33 @@ namespace BirdsiteLive.Domain.Tests.Tools
#endregion
}
[TestMethod]
public void Extract_SingleMentionTag_Dot_Test()
{
#region Stubs
var message = $".@mynickname Bla!{Environment.NewLine}Blo";
#endregion
#region Mocks
var logger = new Mock<ILogger<StatusExtractor>>();
#endregion
var service = new StatusExtractor(_settings, logger.Object);
var result = service.Extract(message);
#region Validations
logger.VerifyAll();
Assert.AreEqual(1, result.tags.Length);
Assert.AreEqual("@mynickname@domain.name", result.tags.First().name);
Assert.AreEqual("Mention", result.tags.First().type);
Assert.AreEqual("https://domain.name/users/mynickname", result.tags.First().href);
Assert.IsTrue(result.content.Contains("Bla!"));
Assert.IsTrue(result.content.Contains("Blo"));
Assert.IsTrue(result.content.Contains(@"<span class=""h-card""><a href=""https://domain.name/@mynickname"" class=""u-url mention"">@<span>mynickname</span></a></span>"));
#endregion
}
[TestMethod]
public void Extract_SingleMentionTag_SpecialChar_Test()
{