Example #1
0
        public static void AreEqual(IExpressionSyntax expected, IExpressionSyntax actual)
        {
            var expectedString  = expected.ToString();
            var actualString    = actual.ToString();
            var expectedType    = expected.GetType().Name;
            var actualType      = actual.GetType().Name;
            var isStringCorrect = string.Equals(expectedString, actualString, StringComparison.Ordinal);
            var isTypeCorrect   = string.Equals(expectedType, actualType, StringComparison.Ordinal);
            var message         = isStringCorrect == isTypeCorrect
                ? $"\r\nExpected: '{expectedString}'<{expected.GetType().Name}>.\r\n  Actual: '{actualString}'<{actual.GetType().Name}>"
                : isStringCorrect
                    ? $"\r\nExpected: <{expectedType}>.\r\n  Actual: <{actualType}>."
                    : $"\r\nExpected: '{expectedString}'.\r\n  Actual: '{actualString}'.";

            Assert.IsTrue(expected.Equals(actual), message);
        }
Example #2
0
 public static void AreEqual(IExpressionSyntax?expected, IExpressionSyntax?actual)
 {
     Assert.IsTrue(ReferenceEquals(expected, actual) || expected?.Equals(actual) == true, GetAssertFailedMessage(expected, actual));
 }