public bool Equals(WithGetReadOnlyPropertySealed <T> other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityComparer <T> .Default.Equals(this.Value, other.Value)); }
public void Replace(ReferenceHandling referenceHandling) { var source = new ObservableCollection <WithGetReadOnlyPropertySealed <int> > { new WithGetReadOnlyPropertySealed <int>(1), new WithGetReadOnlyPropertySealed <int>(2) }; var target = new ObservableCollection <WithGetReadOnlyPropertySealed <int> > { new WithGetReadOnlyPropertySealed <int>(1), new WithGetReadOnlyPropertySealed <int>(2) }; using (Synchronize.PropertyValues(source, target, referenceHandling)) { source[0] = new WithGetReadOnlyPropertySealed <int>(3); var expected = new[] { new WithGetReadOnlyPropertySealed <int>(3), new WithGetReadOnlyPropertySealed <int>(2) }; CollectionAssert.AreEqual(expected, source); CollectionAssert.AreEqual(expected, target); source[1] = new WithGetReadOnlyPropertySealed <int>(4); expected = new[] { new WithGetReadOnlyPropertySealed <int>(3), new WithGetReadOnlyPropertySealed <int>(4) }; CollectionAssert.AreEqual(expected, source); CollectionAssert.AreEqual(expected, target); } }
public void Replace(ReferenceHandling referenceHandling) { var source = new ObservableCollection<WithGetReadOnlyPropertySealed<int>> { new WithGetReadOnlyPropertySealed<int>(1), new WithGetReadOnlyPropertySealed<int>(2) }; var target = new ObservableCollection<WithGetReadOnlyPropertySealed<int>> { new WithGetReadOnlyPropertySealed<int>(1), new WithGetReadOnlyPropertySealed<int>(2) }; using (Synchronize.PropertyValues(source, target, referenceHandling)) { source[0] = new WithGetReadOnlyPropertySealed<int>(3); var expected = new[] { new WithGetReadOnlyPropertySealed<int>(3), new WithGetReadOnlyPropertySealed<int>(2) }; CollectionAssert.AreEqual(expected, source); CollectionAssert.AreEqual(expected, target); source[1] = new WithGetReadOnlyPropertySealed<int>(4); expected = new[] { new WithGetReadOnlyPropertySealed<int>(3), new WithGetReadOnlyPropertySealed<int>(4) }; CollectionAssert.AreEqual(expected, source); CollectionAssert.AreEqual(expected, target); } }
public void SetFields(string name, int value, WithGetReadOnlyPropertySealed <int> immutableValue) { this.name = name; this.value = value; this.immutableValue = immutableValue; }