Files
DevOps/4/ClassLibraryProjects/StringLibraryTests/StringLibraryTests.cs
2026-04-07 20:40:02 +02:00

44 lines
1.1 KiB
C#

using UtilityLibraries;
namespace StringLibraryTests;
[TestClass]
public sealed class StringLibraryTests
{
[TestMethod]
public void TestStartsWithUpper()
{
string[] words = ["Alphabet", "Zebra", "ABC", "Something", "Nothing"];
foreach (string word in words)
{
bool result = word.StartsWithUpper();
Assert.IsTrue(result, $"Expected for '{word}': true; Actual: {result}");
}
}
[TestMethod]
public void TestDoesNotStartWithUpper()
{
string[] words = ["alphabet", "zebra", "abc", "nothing", "something", "1234", ".", ";", " "];
foreach (string word in words)
{
bool result = word.StartsWithUpper();
Assert.IsFalse(result, $"Expected for '{word}': false; Actual: {result}");
}
}
[TestMethod]
public void DirectCallWithNullOrEmpty()
{
string?[] words = [string.Empty, null];
foreach (string? word in words)
{
bool result = StringLibrary.StartsWithUpper(word);
Assert.IsFalse(result, $"Expected for '{word ?? "<null>"}': false; Actual: {result}");
}
}
}