public void IsFirstUpperTestTrue() { // Test expected to return true. string[] words = { "Onkgopotse", "Kgupi", "Alphabet", "Zebra", "ABC" }; foreach (var word in words) { bool result = StringCharCheck.IsFirstUpper(word); Assert.IsTrue(result, string.Format("Expected for '{0}': true; Actual: {1}", word, result)); } }
public void IsFirstUpperTestFalse() { // Test expected to return false. string[] words = { "onkgopotse", "kgupi", "alphabet", "zebra", "abc", "1234", ".", ";", " " }; foreach (var word in words) { bool result = StringCharCheck.IsFirstUpper(word); Assert.IsFalse(result, string.Format("Expected for '{0}': false; Actual: {1}", word, result)); } }
public void IsFirstUpperTestNullOrEmpty() { // Test expected to return false. string[] words = { string.Empty, null }; foreach (var word in words) { bool result = StringCharCheck.IsFirstUpper(word); Assert.IsFalse(result, string.Format("Expected for '{0}': false; Actual: {1}", word == null ? "<null>" : word, result)); } }
static void Main(string[] args) { _AppName = "VDGeneralTestsApp"; Console.WriteLine($"Vision-Dream tests runner '{_AppName}' started...\n"); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); int row = 0; do { if (row == 0 || row >= 15) { ResetConsole(); } string input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } Console.WriteLine($"Input: {input} {"Begins with uppercase? ",30}: " + $"{(StringCharCheck.IsFirstUpper(input) ? "Yes" : "No")}\n"); Console.WriteLine($"Input: {input} {"Formatted returned data is ",30}: " + $"{VDEventLog.ReturnLog(input)}\n"); row += 3; } while (true); return; // Declare a ResetConsole local method void ResetConsole() { if (row > 0) { Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } Console.Clear(); Console.WriteLine("\nPress <Enter> only to exit; otherwise, enter a string and press <Enter>:\n"); row = 3; } }