diff --git a/X10D.Tests/src/Core/StringTests.cs b/X10D.Tests/src/Core/StringTests.cs
index 32d6fb4..6d58576 100644
--- a/X10D.Tests/src/Core/StringTests.cs
+++ b/X10D.Tests/src/Core/StringTests.cs
@@ -9,6 +9,30 @@
[TestClass]
public class StringTests
{
+ ///
+ /// Tests for .
+ ///
+ [TestMethod]
+ public void AsNullIfEmpty()
+ {
+ Assert.AreEqual(null, string.Empty.AsNullIfEmpty());
+ Assert.AreEqual(null, ((string)null).AsNullIfEmpty());
+ Assert.AreEqual(" ", " ".AsNullIfEmpty());
+ Assert.AreEqual("foo", "foo".AsNullIfEmpty());
+ }
+
+ ///
+ /// Tests for .
+ ///
+ [TestMethod]
+ public void AsNullIfWhiteSpace()
+ {
+ Assert.AreEqual(null, string.Empty.AsNullIfWhiteSpace());
+ Assert.AreEqual(null, ((string)null).AsNullIfWhiteSpace());
+ Assert.AreEqual(null, " ".AsNullIfWhiteSpace());
+ Assert.AreEqual("foo", "foo".AsNullIfWhiteSpace());
+ }
+
///
/// Tests for .
///
@@ -18,6 +42,16 @@
Assert.AreEqual("foofoofoofoofoo", "foo".Repeat(5));
}
+ ///
+ /// Tests for .
+ ///
+ [TestMethod]
+ public void Reverse()
+ {
+ Assert.AreEqual("dlroW olleH", StringExtensions.Reverse("Hello World"));
+ Assert.AreEqual("Foobar", StringExtensions.Reverse("rabooF"));
+ }
+
///
/// Tests for .
///
@@ -30,5 +64,18 @@
var arr = str.Split(2).ToArray();
CollectionAssert.AreEqual(new[] { "He", "ll", "o ", "Wo", "rl", "d" }, arr);
}
+
+ ///
+ /// Tests for .
+ ///
+ [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"));
+ }
}
}