public void HintPicksUpDiff() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => "x".Equals("X"); string description; Assert.IsTrue(hint.TryGetHint(x.Body, out description)); Assert.IsNotNull(description); }
public void HintObeysComparer() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => "x".Equals("X", StringComparison.OrdinalIgnoreCase); string description; Assert.IsFalse(hint.TryGetHint(x.Body, out description)); Assert.IsNull(description); }
public void ShouldPickUpControlCharacters() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => "\0Hello".Equals("Hello"); string description; Assert.IsTrue(hint.TryGetHint(x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("control")); }
public void ShouldPickUpMismatchedNewlines() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => new string('\n', 1).Equals("\r\n"); string description; Assert.IsTrue(hint.TryGetHint(x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("carriage-return")); }
public void ShouldPickUpTabVsSpace() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => " ".Equals("\t"); string description; Assert.IsTrue(hint.TryGetHint(x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("tab")); }
public void ShouldPickUpDecomposedCharacters() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => ConstantStrings.AcuteEComposed.Equals(ConstantStrings.AcuteEDecomposed); string description; Assert.IsTrue(hint.TryGetHint(x.Body, out description)); Assert.IsNotNull(description); Assert.IsTrue(description.Contains("decomposed")); }
public void ShouldPickUpFormatCharacters_Right() { var hint = new StringEqualsHint(); Expression<Func<bool>> x = () => "Hello".Equals("\u202DHello"); 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")); }