Advertisement
Guest User

Expand test coverage 1

a guest
Feb 26th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. // Code to add to UnitTest1.cs
  2. [TestMethod]
  3. public void TestStartsWithLower()
  4. {
  5.     // Tests that we expect to return true.
  6.     string[] words = { "alphabet", "zebra", "abc", "αυτοκινητοβιομηχανία", "государство" };
  7.     foreach (var word in words)
  8.     {
  9.         bool result = word.StartsWithLower();
  10.         Assert.IsTrue(result,
  11.                       $"Expected for '{word}': true; Actual: {result}");
  12.     }
  13. }
  14.  
  15. [TestMethod]
  16. public void TestDoesNotStartWithLower()
  17. {
  18.     // Tests that we expect to return false.
  19.     string[] words = { "Alphabet", "Zebra", "ABC", "Αθήνα", "Москва",
  20.                        "1234", ".", ";", " "};
  21.     foreach (var word in words)
  22.     {
  23.         bool result = word.StartsWithLower();
  24.         Assert.IsFalse(result,
  25.                        $"Expected for '{word}': false; Actual: {result}");
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement