Bickle.SpecDescriber.DescribeFailure C# (CSharp) Method

DescribeFailure() public static method

public static DescribeFailure ( Expression spec ) : string
spec Expression
return string
        public static string DescribeFailure(Expression<Func<bool>> spec)
        {
            var binary = spec.Body as BinaryExpression;

            if (binary == null)
                return spec.ToString();

            string description = "Expected: " + DescribeSpec(spec);

            string left = DescribeValue(binary.Left);
            string right = DescribeValue(binary.Right);

            if (!string.IsNullOrEmpty(left))
            {
                description += ", " + left;
            }

            if (!string.IsNullOrEmpty(right))
            {
                description += ", " + right;
            }

            return description;
        }