public void TestNullEmptyBefore() { var function = new RegExReplaceFunction(); try { function.Evaluate("abcdef", null, "-"); Assert.Fail("Expected exception"); } catch (ArgumentException) { //oke } }
public void TestNullAll() { var function = new RegExReplaceFunction(); try { function.Evaluate(null, null, null); Assert.Fail("Expected exception"); } catch (ArgumentException) { //oke } }
public void ComplexPattern() { var function = new RegExReplaceFunction(); var pattern = @"(^\+)|(^00)|(\ |\(|\)|\-)"; Assert.That(function.Evaluate("0614664954", pattern, ""), Is.EqualTo("0614664954")); Assert.That(function.Evaluate("+31614664954", pattern, ""), Is.EqualTo("31614664954")); Assert.That(function.Evaluate("061+4664954", pattern, ""), Is.EqualTo("061+4664954")); Assert.That(function.Evaluate("0031614664954", pattern, ""), Is.EqualTo("31614664954")); Assert.That(function.Evaluate("0031614664954", pattern, ""), Is.EqualTo("31614664954")); Assert.That(function.Evaluate("06 14 66 49 54", pattern, ""), Is.EqualTo("0614664954")); Assert.That(function.Evaluate("(06) 14 66 49 54", pattern, ""), Is.EqualTo("0614664954")); Assert.That(function.Evaluate("06-14664954", pattern, ""), Is.EqualTo("0614664954")); }
public void TestNullSource() { var function = new RegExReplaceFunction(); Assert.That(function.Evaluate(null, "a", "b"), Is.EqualTo("")); }
public void TestNullEmptyAfter() { var function = new RegExReplaceFunction(); Assert.That(function.Evaluate("a-b-c-d-e-f", "-", null), Is.EqualTo("abcdef")); }
public void TestAllFilled() { var function = new RegExReplaceFunction(); Assert.That(function.Evaluate("a-b-c-d-e-f", "-", "+"), Is.EqualTo("a+b+c+d+e+f")); }