public void ExtractRangesExpectedBehavior() { string text = "abcd7-11tyya-h224bI-M*()&-%$"; string expectedText = "abcdtyy224b*()&%$"; string expectedRanges = "7891011abcdefghIJKLM-"; string actualRanges = ""; List <string> ranges = StringFunction.ExtractRanges(ref text); foreach (string s in ranges) { actualRanges += s; } Assert.AreEqual(expectedText, text); Assert.AreEqual(expectedRanges, actualRanges); }