public void It_works_even_if_deserialized()
            {
                var a = new TestModelOne
                {
                    Id   = 1,
                    Name = "One"
                };

                var b = JsonConvert.DeserializeObject <TestModelOne>(@"{
					""Id"": 2,
					""Name"": ""One""
				}"                );

                var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);

                Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                Assert.Single(comparison);
            }
            public void It_ignores_equal_fields()
            {
                var a = new TestModelOne
                {
                    Id   = 1,
                    Name = "One"
                };

                var b = new TestModelOne
                {
                    Id   = 2,
                    Name = "O" + "n" + "e"
                };

                var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);

                Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                Assert.Single(comparison);
            }
            public void It_detects_differences()
            {
                var a = new TestModelOne
                {
                    Id   = 1,
                    Name = "A"
                };

                var b = new TestModelOne
                {
                    Id   = 2,
                    Name = "B"
                };

                var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);

                Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Name));
                Assert.Equal(2, comparison.Count);
            }
            public void It_does_not_crash_if_something_is_null()
            {
                {
                    var a = new TestModelOne
                    {
                        Id        = 1,
                        Name      = "One",
                        Challenge = new TestModelTwo(),
                    };

                    var b = new TestModelOne
                    {
                        Id   = 2,
                        Name = "One"
                    };

                    var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Challenge));
                    Assert.Equal(2, comparison.Count);
                }

                {
                    var a = new TestModelOne
                    {
                        Id   = 1,
                        Name = "One",
                    };

                    var b = new TestModelOne
                    {
                        Id        = 2,
                        Name      = "One",
                        Challenge = new TestModelTwo()
                    };

                    var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Challenge));
                    Assert.Equal(2, comparison.Count);
                }

                {
                    var a = new TestModelOne
                    {
                        Id        = 1,
                        Name      = "One",
                        Challenge = new TestModelTwo()
                    };

                    var b = new TestModelOne
                    {
                        Id        = 2,
                        Name      = "One",
                        Challenge = new TestModelTwo()
                    };

                    var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Challenge));
                    Assert.Equal(2, comparison.Count);
                }

                {
                    var challenge = new TestModelTwo();

                    var a = new TestModelOne
                    {
                        Id        = 1,
                        Name      = "One",
                        Challenge = challenge
                    };

                    var b = new TestModelOne
                    {
                        Id        = 2,
                        Name      = "One",
                        Challenge = challenge
                    };

                    var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                    Assert.Single(comparison);
                }

                {
                    var challenge = new TestModelTwo();

                    var a = new TestModelOne
                    {
                        Id        = 1,
                        Name      = "One",
                        Challenge = challenge,
                        TestValueEqualsDateTime = DateTime.Now
                    };

                    var b = new TestModelOne
                    {
                        Id        = 2,
                        Name      = "One",
                        Challenge = challenge
                    };

                    var comparison = ObjectComparer.GetParametersWithValueDifference(a, b);
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.Id));
                    Assert.Contains(comparison, item => item.Property.Name == nameof(TestModelOne.TestValueEqualsDateTime));
                    Assert.Equal(2, comparison.Count);
                }
            }