public void DoesTriggerOnDifferentStrings() { var hint = new StringOperatorEqualsHint(); Expression <Func <bool> > x = () => new string('x', 1) == "X"; // prevent inlining the constant var p = new ExpressionParser(x.Body); string description; Assert.IsTrue(hint.TryGetHint(p, x.Body, out description)); Assert.IsNotNull(description); }
public void ShouldPickUpFormatCharacters() { var hint = new StringOperatorEqualsHint(); Expression <Func <bool> > x = () => new string('\u202d', 1) + "Hello" == "Hello"; // prevent inlining the constant var p = new ExpressionParser(x.Body); string description; Assert.IsTrue(hint.TryGetHint(p, x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("format")); }
public void ShouldPickUpMismatchedNewlines() { var hint = new StringOperatorEqualsHint(); Expression <Func <bool> > x = () => new string('\n', 1) == "\r\n"; // prevent inlining the constant var p = new ExpressionParser(x.Body); string description; Assert.IsTrue(hint.TryGetHint(p, x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("carriage-return")); }
public void ShouldPickUpTabVsSpace() { var hint = new StringOperatorEqualsHint(); Expression <Func <bool> > x = () => new string(' ', 1) == "\t"; // prevent inlining the constant var p = new ExpressionParser(x.Body); string description; Assert.IsTrue(hint.TryGetHint(p, x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("tab")); }
public void ShouldPickUpDecomposedCharacters() { var hint = new StringOperatorEqualsHint(); Expression <Func <bool> > x = () => ConstantStrings.AcuteEComposed == ConstantStrings.AcuteEDecomposed; var p = new ExpressionParser(x.Body); string description; Assert.IsTrue(hint.TryGetHint(p, x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("decomposed")); }