public void Test_Fast_Reflection_Set_Standard() { var o = new Student { Age = 23, Friends = 12, GPA = 3.2, Grade = Grade.A, Name = "Jordan Spears", Tall = true, Nice = false }; Ject.Set(o, "Age", 25); Assert.AreEqual(25, o.Age); Ject.Set(o, "Friends", 1); Assert.AreEqual(1, o.Friends); Ject.Set(o, "GPA", 1.2); Assert.AreEqual(1.2, o.GPA); Ject.Set(o, "Grade", Grade.C); Assert.AreEqual(Grade.C, o.Grade); Ject.Set(o, "Name", "Seth Juarez"); Assert.AreEqual("Seth Juarez", o.Name); Ject.Set(o, "Tall", false); Assert.AreEqual(false, o.Tall); Ject.Set(o, "Nice", true); Assert.AreEqual(true, o.Nice); }
public void Test_Fast_Reflection_Get_Standard() { var o = new Student { Age = 23, Friends = 12, GPA = 3.2, Grade = Grade.A, Name = "Jordan Spears", Tall = true, Nice = false }; var age = Ject.Get(o, "Age"); Assert.AreEqual(23, (int)age); var friends = Ject.Get(o, "Friends"); Assert.AreEqual(12, (int)friends); var gpa = Ject.Get(o, "GPA"); Assert.AreEqual(3.2, (double)gpa); var grade = Ject.Get(o, "Grade"); Assert.AreEqual(Grade.A, (Grade)grade); var name = Ject.Get(o, "Name"); Assert.AreEqual("Jordan Spears", (string)name); var tall = Ject.Get(o, "Tall"); Assert.AreEqual(true, (bool)tall); var nice = Ject.Get(o, "Nice"); Assert.AreEqual(false, (bool)nice); }