public void trim_non_digits_zero_length() { CreditCardDerived ccd = new CreditCardDerived(); string text = ""; string expected = ""; string actual = ccd.TrimNotDigits_ForUnitTest(text); Assert.AreEqual(expected, actual); }
public void trim_non_digits() { CreditCardDerived ccd = new CreditCardDerived(); string text = "tga12341234ytm"; string expected = "12341234"; string actual = ccd.TrimNotDigits_ForUnitTest(text); Assert.AreEqual(expected, actual); }
public void trim_non_digits_big_text() { // This test was written when the function was refactored for performance. This test // should take no more than 1 second to run. Previously it was taking 21 seconds to run. int repeat = 10000; CreditCardDerived ccd = new CreditCardDerived(); string lotsOfCharacters = String.Join("", Enumerable.Repeat("abcdef", repeat).ToArray()); string text = lotsOfCharacters + "1" + lotsOfCharacters; string expected = "1"; string actual = ccd.TrimNotDigits_ForUnitTest(text); Assert.AreEqual(expected, actual); }