public void ImportValues() { object mother = new Person { Name = "Francine", Age = 22 }; object son = new Person { Age = 4, Gender = "M" }; mother.ImportValues(son); Assert.AreEqual(4, mother.Get("Age")); }
public void Indexer() { object person = new Person { Name = "Wagner" }; var reflection = new PhantomReflection(person); reflection["Age"] = 24; Assert.AreEqual("Wagner", reflection["Name"]); Assert.AreEqual(24, reflection["Age"]); }
public void Properties() { object person = new Person { Name = "Arthur", Age = 4 }; var propertiesInfo = person.Properties(); propertiesInfo[1].SetValue(person, 5, null); Assert.AreEqual(5, person.Get("Age")); }
public void GetString() { object person = new Person { Name = "Arthur", Age = 4 }; Assert.AreEqual("Arthur", person.GetString("Name")); }
public void Values() { object person = new Person { Name = "Francine", Age = 22 }; var properties = person.Values(); Assert.AreEqual(3, properties.Count); Assert.AreEqual("Francine", properties["Name"]); }
public void Set() { object person = new Person { Name = "Arthur", Age = 4 }; person.Set("Name", "Arthur Andrade"); Assert.AreEqual("Arthur Andrade", person.Get("Name")); }
public void PropertyNotFoundException() { object person = new Person { Name = "Francine", Age = 22 }; person.Get("Height"); }