diff --git a/X10D.Tests/src/Core/StringTests.cs b/X10D.Tests/src/Core/StringTests.cs index 32c2685..fb97e51 100644 --- a/X10D.Tests/src/Core/StringTests.cs +++ b/X10D.Tests/src/Core/StringTests.cs @@ -65,16 +65,31 @@ namespace X10D.Tests.Core } /// - /// Tests for . + /// Tests and + /// . /// [TestMethod] public void WithAlternative() { - Assert.AreEqual("Hello", "Hello".WithAlternative("Discarded")); - Assert.AreEqual("Alternative", string.Empty.WithAlternative("Alternative")); - Assert.AreEqual(" ", " ".WithAlternative("Discarded")); - Assert.AreEqual("Alternative", " ".WithAlternative("Alternative", true)); - Assert.AreEqual("Alternative", ((string)null).WithAlternative("Alternative")); + const string inputA = "Hello World"; + const string inputB = " "; + const string inputC = ""; + const string? inputD = null; + const string alternative = "ALTERNATIVE"; + + string resultA = inputA.WithEmptyAlternative(alternative); + string resultB = inputB.WithEmptyAlternative(alternative); + string resultBWithWhitespace = inputB.WithWhiteSpaceAlternative(alternative); + string resultC = inputC.WithEmptyAlternative(alternative); + string resultD = inputD.WithEmptyAlternative(alternative); + + Assert.ThrowsException(() => ((string?)null).WithEmptyAlternative(null!)); + + Assert.AreEqual(resultA, inputA); + Assert.AreEqual(resultB, inputB); + Assert.AreEqual(resultBWithWhitespace, alternative); + Assert.AreEqual(resultC, alternative); + Assert.AreEqual(resultD, alternative); } } }