﻿using NUnit.Framework;

namespace Corelicious.Extensions {
    [TestFixture]
    public class StringExtensionsTests {
        [Test]
        public void Truncate() {
            Assert.That(StringExtensions.Truncate("Hello world", 100), Is.EqualTo("Hello world"));
            Assert.That(StringExtensions.Truncate("Hello world", 12), Is.EqualTo("Hello world"));
            Assert.That(StringExtensions.Truncate("Hello world", 11), Is.EqualTo("Hello world"));
            Assert.That(StringExtensions.Truncate("Hello world", 10), Is.EqualTo("Hello…"));
            Assert.That(StringExtensions.Truncate("Hello world", 9), Is.EqualTo("Hello…"));

            Assert.That(StringExtensions.Truncate("Hello world!", 100), Is.EqualTo("Hello world!"));
            Assert.That(StringExtensions.Truncate("Hello world!", 12), Is.EqualTo("Hello world!"));
            Assert.That(StringExtensions.Truncate("Hello world!", 11), Is.EqualTo("Hello…"));
            Assert.That(StringExtensions.Truncate("Hello world!", 10), Is.EqualTo("Hello…"));
            Assert.That(StringExtensions.Truncate("Hello world!", 9), Is.EqualTo("Hello…"));
        }
    }
}
