public void WithValidParams_CopyOnlyPropertiesToNewObject() { var source = ObjectAttr.GetDefault(); var target = source.CopyOnlyPropertiesToNew <ObjectAttr>(nameof(ObjectAttr.Name)); Assert.AreEqual(source.Name, target.Name); }
public void WithValidObjectAttr_CopyPropertiesToTarget() { var source = ObjectAttr.GetDefault(); var target = new ObjectAttr(); source.CopyPropertiesTo(target); Assert.AreEqual(source.Name, target.Name); Assert.AreEqual(source.IsActive, target.IsActive); }
public void WithObjectWithCopyableAttribute_CopyPropertiesToNewObjectAttr() { var source = ObjectAttr.GetDefault(); var destination = source.CopyPropertiesToNew <ObjectAttr>(); Assert.IsNotNull(destination); Assert.AreSame(source.GetType(), destination.GetType()); Assert.AreNotEqual(source.Id, destination.Id); Assert.AreEqual(source.Name, destination.Name); Assert.AreEqual(source.IsActive, destination.IsActive); }
public void WithNullObjectAttr_CopyPropertiesToTarget() { Assert.Throws <ArgumentNullException>(() => ObjectAttr.GetDefault().CopyPropertiesTo(null)); }