public void SubstringContainsWithFunc() { var s = new Substring("_Hello ", 2, 2); s.Contains(char.IsWhiteSpace).Should().BeFalse(); s.Contains(char.IsUpper).Should().BeFalse(); s.Contains(char.IsLower).Should().BeTrue(); s.Contains(c => c == 'e').Should().BeTrue(); }
public void SubstringContainsWithInvalidFunc() { var s = new Substring("Hello", 0); Action contains = () => s.Contains(null); contains.Should().Throw <ArgumentNullException>(); }
public void SubstringContains() { var s = new Substring("_Hello", 1, 2); s.Contains('_').Should().BeFalse(); s.Contains('H').Should().BeTrue(); s.Contains('e').Should().BeTrue(); s.Contains('l').Should().BeFalse(); s.Contains('o').Should().BeFalse(); s.Contains('m').Should().BeFalse(); }
public void Append(Substring theInput) { for (int i = 0; i < theInput.Length; i++) { char input = theInput[i]; if (isStandard && input != '\u00a0' && char.IsWhiteSpace(input)) { if (!myWhitespace) { myText.Append(' '); myLastTag = myLastTag + " "; } myWhitespace = true; } else { switch (input) { case '\u201c': input = '"'; break; case '\u201d': input = '"'; break; case '\u2018': input = '\''; break; case '\u2019': input = '\''; break; case '\u00a0': input = ' '; break; case '&': if (theInput.Contains(i + 1, "nbsp;")) { input = ' '; i += 5; } break; } myText.Append(input); myWhitespace = false; myLastTag = string.Empty; } } }
public void SubstringContainsWithInvalidFunc() { var s = new Substring("Hello", 0); Action contains = () => s.Contains(null); contains.ShouldThrow<ArgumentNullException>(); }
public void Contains(string input, char trimChar, bool expected) { var actual = Substring.Contains(input, trimChar); Assert.Equal(expected, actual); }