public void HandlesPropertyChangedEmptyAndNull(string prop)
            {
                var source = new WithSimpleProperties {
                    IntValue = 1, StringValue = "2"
                };
                var target = new WithSimpleProperties {
                    IntValue = 3, StringValue = "4"
                };

                foreach (var referenceHandling in Enum.GetValues(typeof(ReferenceHandling)).Cast <ReferenceHandling>())
                {
                    source.IntValue    = 1;
                    source.StringValue = "2";
                    target.IntValue    = 3;
                    target.StringValue = "4";
                    using (Synchronize.PropertyValues(source, target, referenceHandling))
                    {
                        Assert.AreEqual(1, source.IntValue);
                        Assert.AreEqual(1, target.IntValue);
                        Assert.AreEqual("2", source.StringValue);
                        Assert.AreEqual("2", target.StringValue);

                        source.SetFields(5, "6");
                        source.OnPropertyChanged(prop);
                        Assert.AreEqual(5, source.IntValue);
                        Assert.AreEqual(5, target.IntValue);
                        Assert.AreEqual("6", source.StringValue);
                        Assert.AreEqual("6", target.StringValue);
                    }
                }
            }
            public void HandlesPropertyChangedEmptyAndNull(string prop)
            {
                var x = new WithSimpleProperties(1, DateTime.MinValue);
                var y = new WithSimpleProperties(1, DateTime.MinValue);
                var propertyChanges = new List <string>();
                var expectedChanges = new List <string>();

                using (var tracker = Track.IsDirty(x, y))
                {
                    tracker.PropertyChanged += (_, e) => propertyChanges.Add(e.PropertyName);
                    Assert.AreEqual(false, tracker.IsDirty);
                    Assert.AreEqual(null, tracker.Diff);
                    CollectionAssert.IsEmpty(propertyChanges);

                    x.SetFields(1, DateTime.MinValue.AddSeconds(1));
                    x.OnPropertyChanged(prop);
                    Assert.AreEqual(true, tracker.IsDirty);
                    Assert.AreEqual("WithSimpleProperties Time x: 0001-01-01T00:00:01.0000000 y: 0001-01-01T00:00:00.0000000", tracker.Diff.ToString("", " "));
                    expectedChanges.AddRange(new[] { "Diff", "IsDirty" });
                    CollectionAssert.AreEqual(expectedChanges, propertyChanges);
                }
            }
            public void HandlesPropertyChangedEmptyAndNull(string prop)
            {
                var x = new WithSimpleProperties(1, DateTime.MinValue);
                var y = new WithSimpleProperties(1, DateTime.MinValue);
                var propertyChanges = new List<string>();
                var expectedChanges = new List<string>();
                using (var tracker = Track.IsDirty(x, y))
                {
                    tracker.PropertyChanged += (_, e) => propertyChanges.Add(e.PropertyName);
                    Assert.AreEqual(false, tracker.IsDirty);
                    Assert.AreEqual(null, tracker.Diff);
                    CollectionAssert.IsEmpty(propertyChanges);

                    x.SetFields(1, DateTime.MinValue.AddSeconds(1));
                    x.OnPropertyChanged(prop);
                    Assert.AreEqual(true, tracker.IsDirty);
                    Assert.AreEqual("WithSimpleProperties Time x: 0001-01-01T00:00:01.0000000 y: 0001-01-01T00:00:00.0000000", tracker.Diff.ToString("", " "));
                    expectedChanges.AddRange(new[] { "Diff", "IsDirty" });
                    CollectionAssert.AreEqual(expectedChanges, propertyChanges);
                }
            }
            public void HandlesPropertyChangedEmptyAndNull(string prop)
            {
                var source = new WithSimpleProperties { IntValue = 1, StringValue = "2" };
                var target = new WithSimpleProperties { IntValue = 3, StringValue = "4" };
                foreach (var referenceHandling in Enum.GetValues(typeof(ReferenceHandling)).Cast<ReferenceHandling>())
                {
                    source.IntValue = 1;
                    source.StringValue = "2";
                    target.IntValue = 3;
                    target.StringValue = "4";
                    using (Synchronize.PropertyValues(source, target, referenceHandling))
                    {
                        Assert.AreEqual(1, source.IntValue);
                        Assert.AreEqual(1, target.IntValue);
                        Assert.AreEqual("2", source.StringValue);
                        Assert.AreEqual("2", target.StringValue);

                        source.SetFields(5, "6");
                        source.OnPropertyChanged(prop);
                        Assert.AreEqual(5, source.IntValue);
                        Assert.AreEqual(5, target.IntValue);
                        Assert.AreEqual("6", source.StringValue);
                        Assert.AreEqual("6", target.StringValue);
                    }
                }
            }