Ejemplo n.º 1
0
        public static void ShouldMatch <T>(this ExpectedObject expected, T actual)
        {
            IWriter writer = new ShouldWriter();

            if (!expected.Equals(actual, writer, true))
            {
                var results = writer.GetFormattedResults();
                throw new ComparisonException(results);
            }
        }
Ejemplo n.º 2
0
        public static void ShouldEqual <T>(this ExpectedObject expected, T actual)
        {
            IWriter writer = new ShouldWriter();

            if (!expected.Equals(actual, writer))
            {
                var results = writer.GetFormattedResults();

                if (!string.IsNullOrEmpty(results))
                {
                    throw new ComparisonException(results);
                }
            }
        }
Ejemplo n.º 3
0
        public static void ShouldNotMatch <T>(this ExpectedObject expected, T actual)
        {
            var writer = new ShouldWriter();

            if (expected.Equals(actual, writer, true))
            {
                var sb = new StringBuilder();
                sb.Append($"The expected object should not match the actual object.");
                sb.Append(Environment.NewLine);
                sb.Append(Environment.NewLine);
                sb.Append(writer.GetTrunkFormattedResults());
                throw new ComparisonException(sb.ToString());
            }
        }
 public bool Equals(ExpectedObject other)
 {
     throw new Exception("ExpectedObject is not intended to be compared to another ExpectedObject");
 }
Ejemplo n.º 5
0
 public bool Equals(ExpectedObject other)
 {
     throw new ComparisonException($"Objects of type {nameof(ExpectedObject)} can not be compared to another instance of {nameof(ExpectedObject)}.");
 }
 public static bool DoesNotMatch(this ExpectedObject expected, object actual)
 {
     return(!expected.Equals(actual, new NullWriter(), true));
 }