public void EqualDummies()
 {
     var expected = new Dummy { Value = 2 };
     var actual = new Dummy { Value = 2 };
     JsonSerializerAssert.Equal(expected, actual);
     JsonSerializerAssert.Equal(expected, actual, this.serializerSettings);
 }
 public void ToEscapedJson()
 {
     var dummy = new Dummy { Value = 2 };
     var json = JsonSerializerAssert.ToEscapedJson(dummy);
     var expected = "\"{\\\"Value\\\":2}\"";
     Assert.AreEqual(expected, json);
 }
 public void ToJson()
 {
     var dummy = new Dummy { Value = 2 };
     var json = JsonSerializerAssert.ToJson(dummy);
     Console.Write(json);
     var expected = "{\"Value\":2}";
     Assert.AreEqual(expected, json);
 }
 public void Dummy()
 {
     var actual = new Dummy { Value = 2 };
     var roundtrips = new[]
                          {
                              JsonSerializerAssert.Roundtrip(actual),
                              JsonSerializerAssert.Roundtrip(actual, this.serializerSettings),
                          };
     foreach (var roundtrip in roundtrips)
     {
         Assert.AreNotSame(actual, roundtrip);
         Assert.AreEqual(2, actual.Value);
         Assert.AreEqual(2, roundtrip.Value);
     }
 }
            public void Dummy()
            {
                var actual = new Dummy { Value = 2 };
                var expectedJson = "{\"Value\":2}";

                var roundtrips = new[]
                                     {
                                         JsonSerializerAssert.Equal(expectedJson, actual),
                                         JsonSerializerAssert.Equal(expectedJson, actual, JsonAssertOptions.Default),
                                         JsonSerializerAssert.Equal(expectedJson, actual, JsonAssertOptions.Verbatim),
                                         JsonSerializerAssert.Equal(expectedJson, actual, this.serializerSettings, JsonAssertOptions.Verbatim),
                                     };
                foreach (var roundtrip in roundtrips)
                {
                    Assert.AreNotSame(actual, roundtrip);
                    Assert.AreEqual(2, roundtrip.Value);
                }
            }
            public void NotEqualDummies()
            {
                var expected = new Dummy { Value = 1 };
                var actual = new Dummy { Value = 2 };

                var exceptions = new[]
                                    {
                                       Assert.Throws<AssertException>(() => JsonSerializerAssert.Equal(expected, actual)),
                                       Assert.Throws<AssertException>(() => JsonSerializerAssert.Equal(expected, actual, this.serializerSettings)),
                                    };
                var expectedMessage = "  Json differ at line 1 index 9.\r\n" +
                                      "  Expected: 1| {\"Value\":1}\r\n" +
                                      "  But was:  1| {\"Value\":2}\r\n" +
                                      "  ----------------------^";
                foreach (var exception in exceptions)
                {
                    Assert.AreEqual(expectedMessage, exception.Message);
                }
            }