public void WithArrayWhenTargetArrayIsNull(ReferenceHandling referenceHandling) { var x = new WithArrayProperty("a", 1, new[] { 1, 2 }); var y = new WithArrayProperty("a", 1, null); var result = this.EqualMethod(x, y, referenceHandling); Assert.AreEqual(false, result); }
public void With_array_property_invalid_length() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m31 = new WithArrayProperty(m11, m11); var m32 = new WithArrayProperty(m12); ModelAssert.AreEqual(m31, m32); }
public void With_array_property_nullable_entry_valid() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m31 = new WithArrayProperty(m11, m11, null); var m32 = new WithArrayProperty(m12, m12, null); ModelAssert.AreEqual(m31, m32); }
public void With_array_property_mismatch() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m13 = new WithFields("F2", 2); var m31 = new WithArrayProperty(m11, m11); var m32 = new WithArrayProperty(m12, m13); ModelAssert.AreEqual(m31, m32); }
public void WithArrayWhenTargetArrayIsNull(ReferenceHandling referenceHandling) { var x = new WithArrayProperty("a", 1, new[] { 1, 2 }); var y = new WithArrayProperty("a", 1, null); var result = this.DiffMethod(x, y, referenceHandling); var expected = this is FieldValues.Classes ? "WithArrayProperty <Array>k__BackingField x: System.Int32[] y: null" : "WithArrayProperty Array x: System.Int32[] y: null"; Assert.AreEqual(expected, result.ToString(string.Empty, " ")); }
public void WithArrayWhenTargetArrayIsNullReference() { var source = new WithArrayProperty("a", 1, new[] { 1, 2 }); var target = new WithArrayProperty("a", 1, null); this.CopyMethod(source, target, ReferenceHandling.References); Assert.AreEqual("a", source.Name); Assert.AreEqual("a", target.Name); Assert.AreEqual(1, source.Value); Assert.AreEqual(1, target.Value); Assert.AreSame(source.Array, target.Array); CollectionAssert.AreEqual(new[] { 1, 2 }, source.Array); }
public void With_array_property_null_array_invalid() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m31 = new WithArrayProperty { Property = null }; var m32 = new WithArrayProperty(m12, m12, null); ModelAssert.AreEqual(m31, m32); }
public void WithArrayWhenTargetArrayIsNullStructural(ReferenceHandling referenceHandling) { var source = new WithArrayProperty("a", 1, new[] { 1, 2 }); var target = new WithArrayProperty("a", 1, null); this.CopyMethod(source, target, referenceHandling); Assert.AreEqual("a", source.Name); Assert.AreEqual("a", target.Name); Assert.AreEqual(1, source.Value); Assert.AreEqual(1, target.Value); if (referenceHandling == ReferenceHandling.Structural) { Assert.AreNotSame(source.Array, target.Array); } else { Assert.AreSame(source.Array, target.Array); } CollectionAssert.AreEqual(new[] { 1, 2 }, source.Array); CollectionAssert.AreEqual(new[] { 1, 2 }, target.Array); }
public void With_array_property_null_array_invalid() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m31 = new WithArrayProperty { Property = null }; var m32 = new WithArrayProperty(m12, m12, null); ModelAssert.AreEqual(m31,m32); }
public void With_array_property_nullable_entry_valid() { var m11 = new WithFields("F1", 2); var m12 = new WithFields("F1", 2); var m31 = new WithArrayProperty(m11, m11,null); var m32 = new WithArrayProperty(m12, m12, null); ModelAssert.AreEqual(m31, m32); }