FruityFoundation/Base.Tests/Structures/StringExtensionTests.cs
Kyle Ratti 0e7e161327
1.3.0
2023-08-01 22:32:23 -04:00

28 lines
1.1 KiB
C#

using FruityFoundation.Base.Structures;
using NUnit.Framework;
namespace Base.Tests.Structures;
public class StringExtensionTests
{
[Test]
[TestCase("banana", "banana", ExpectedResult = true)]
[TestCase("banana", "baNAnA", ExpectedResult = true)]
[TestCase("tuckerIsMyDog", "tuckerisMYdog", ExpectedResult = true)]
[TestCase("if I were a dog, I'd go insane", "how do dogs not get bored", ExpectedResult = false)]
public bool EqualsIgnoreCaseTests(string inputOne, string inputTwo) =>
inputOne.EqualsIgnoreCase(inputTwo);
[Test]
[TestCase("bananas have potassium", "banana", ExpectedResult = true)]
[TestCase("you can't spell trucker without ucker", "UCKER", ExpectedResult = true)]
public bool ContainsIgnoreCaseTests(string haystack, string needle) =>
haystack.ContainsIgnoreCase(needle);
[Test]
[TestCase("banana", 1, ExpectedResult = "b")]
[TestCase("This is a longer sentence. I would like it capped at 30 characters.", 30, ExpectedResult = "This is a longer sentence. I w")]
public string StringTruncateTests(string str, int maxLength) =>
str.Truncate(maxLength);
}