public void ApplyTo_EquivalentJObjects_Passes()
        {
            JsonEqualsConstraint constraint = new JsonEqualsConstraint(JObject.FromObject(new { Name = "FOO" }));
            ConstraintResult     result     = constraint.ApplyTo(JObject.FromObject(new { Name = "FOO" }));

            Assert.That(result, Has.Property <ConstraintResult>(r => r.IsSuccess).True, result.ToString());
        }
        public void ApplyTo_DifferentJObjects_Fails()
        {
            JsonEqualsConstraint constraint = new JsonEqualsConstraint(JObject.FromObject(new { Name = "FOO" }));
            ConstraintResult     result     = constraint.ApplyTo(JObject.FromObject(new { Name = "FOX" }));

            Assert.That(result, Has.Property <ConstraintResult>(r => r.IsSuccess).False, result.ToString());

            Assert.That(result.ToString(), Is.EqualTo("JTokens did not match." +
                                                      "\r\n  Value at 'Name' was not equals." +
                                                      "\r\n    Expected: FOX" +
                                                      "\r\n    But was:  FOO\r\n\r\n"));
        }
        public void ApplyTo_DifferentJArrays_Fails()
        {
            JsonEqualsConstraint constraint = new JsonEqualsConstraint(JArray.FromObject(new [] { "ONE", "TWO", "THREE", "FOUR" }))
                                              .AllowArrayOutOfOrder();
            ConstraintResult result = constraint.ApplyTo(JArray.FromObject(new[] { "ONE", "TWO", "FOUR", "FIVE" }));

            Assert.That(result, Has.Property <ConstraintResult>(r => r.IsSuccess).False, result.ToString());

            string str = result.ToString();

            Assert.That(result.ToString(), Is.EqualTo("JTokens did not match." +
                                                      "\r\n  Value at '' was not equals." +
                                                      "\r\n    Expected: <missing>" +
                                                      "\r\n    But was:  THREE" +
                                                      "\r\n" +
                                                      "\r\n  Value at '' was not equals." +
                                                      "\r\n    Expected: FIVE" +
                                                      "\r\n    But was:  <extra>" +
                                                      "\r\n" +
                                                      "\r\n"));
        }