public void CanShortenTextWithoutSpaces() { var limit = 50; var newText = TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(100, 200), limit); Assert.AreEqual(limit + EllipsisLength, newText.Length); }
public void CanShortenTextByNotTruncatingShortText() { var limit = 50; var textLength = RandomValueGenerator.Integer(30, 40); var newText = TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(textLength), limit); Assert.AreEqual(textLength, newText.Length); }
public void CanShortenTextWithSpaces() { var limit = 50; var spacePosition = RandomValueGenerator.Integer(100, 200); var text = $"{RandomValueGenerator.AlphaNumericText(spacePosition)} {RandomValueGenerator.AlphaNumericText(100, 200)}"; var newText = TextManipulations.ShortenText(text, limit); Assert.AreEqual(spacePosition + EllipsisLength, newText.Length); }
public void CanShortenTextWithNull() { var newText = TextManipulations.ShortenText(null, 50); Assert.IsNull(newText); }
public void CanCallShortenText() { TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(100, 200), 50); }