public string TrimEndOnce(string input, string startsWith, StringComparison comparisonType) { string result = CommonStringExtensions.TrimEndOnce(input, startsWith, comparisonType); PexAssert.IsNotNull(result); PexAssert.IsTrue(result.Length <= input.Length); int originalStartsWithCount = CommonStringExtensions.CountSubstringStart(input, startsWith); int resultStartsWithCount = CommonStringExtensions.CountSubstringStart(result, startsWith); PexAssert.IsTrue(originalStartsWithCount - resultStartsWithCount <= 1); return(result); }