public void EqualityComparer()
        {
            AccountWithEquals account = new AccountWithEquals
            {
                Name = "main"
            };
            AccountWithEquals manager = new AccountWithEquals
            {
                Name = "main"
            };

            account.Manager = manager;

            ExceptionAssert.Throws <JsonSerializationException>(
                () => JsonConvert.SerializeObject(account),
                "Self referencing loop detected for property 'Manager' with type 'Newtonsoft.Json.Tests.Serialization.AccountWithEquals'. Path ''.");

            string json = JsonConvert.SerializeObject(account, new JsonSerializerSettings
            {
                EqualityComparer = new ReferenceEqualsEqualityComparer(),
                Formatting       = Formatting.Indented
            });

            StringAssert.AreEqual(@"{
  ""Name"": ""main"",
  ""Manager"": {
    ""Name"": ""main"",
    ""Manager"": null
  }
}", json);
        }
        public override bool Equals(object obj)
        {
            AccountWithEquals a = obj as AccountWithEquals;

            if (a == null)
            {
                return(false);
            }

            return(Name == a.Name);
        }