public void TestPropertyExclusion() { var cloner = new IlClonerFluent <TestClassWithPropertyExclusion>() .Exclude(x => x.PropA) .CreateCloner(); var obj = new TestClassWithPropertyExclusion() { PropA = "ASDF" }; var cloned = cloner(obj); Assert.AreNotEqual(obj.PropA, cloned.PropA); Assert.IsNull(cloned.PropA); }
public void TestFieldExclusion() { var cloner = new IlClonerFluent <TestClassWithFieldExclusion>() .Exclude(x => x.FieldA) .CreateCloner(); var obj = new TestClassWithFieldExclusion() { FieldA = "ASDF" }; var cloned = cloner(obj); Assert.AreNotEqual(obj.FieldA, cloned.FieldA); Assert.IsNull(cloned.FieldA); }