Example #1
0
 public void Clean_SelectingDigits_OnlyReturnsDigits()
 {
     const string valueToClean = "asdfcd324asdf11";
     const string regexString = @"(\d+)";
     var cleaner = new RegexpCleaner(regexString);
     string actual = cleaner.Clean(valueToClean);
     Console.WriteLine(String.Format("Clean result = {0}", actual));
     Assert.AreEqual("324", actual);
 }
Example #2
0
 public void Clean_SelectingAlphaCharacters_ReturnsAlphaCharacters()
 {
     const string valueToClean = "asdfCD324asdf11";
     const string regexString = @"([a-zA-Z]+)";
     var cleaner = new RegexpCleaner(regexString);
     string actual = cleaner.Clean(valueToClean);
     Console.WriteLine(String.Format("Clean result = {0}", actual));
     Assert.AreEqual("asdfCD", actual);
 }
Example #3
0
 public void Clean_SelectingDigitsOfSecondGroup_ReturnsSecondGroup()
 {
     const string valueToClean = "123-4567";
     const string regexString = @"(\d{3})-(\d{4})";
     var cleaner = new RegexpCleaner(regexString);
     cleaner.SetGroup(2);
     string actual = cleaner.Clean(valueToClean);
     Console.WriteLine(String.Format("Clean result = {0}", actual));
     Assert.AreEqual("4567", actual);
 }