public void As_Test() { var Emmy = new Employee { Id = 9, Name = "Emmy", Salary = 27000.00M }; Person EmmyPerson = Emmy.As<Person>(); Employee EmmyEmployee = EmmyPerson.As<Employee>(); }
public void Get_Test() { var Cobie = new Employee { Id = 5, Name = "Cobie", Salary = 700000.00M }; string name = Cobie.Get<string>("Name"); Assert.AreEqual("Cobie", name); decimal salary = (decimal)Cobie.Get("Salary"); Assert.AreEqual(700000.00, (double)salary, 0.01); }
public void Invoke_Test() { var John = new Employee { Id = 1, Name = "John", Salary = 125000.00M }; decimal res1 = John.Invoke<decimal>("GetSalaryPerMonth"); Assert.AreEqual(10416.66, (double)res1, 0.01); decimal res2 = (decimal)John.Invoke("GetSalaryPerMonth"); Assert.AreEqual(10416.66, (double)res2, 0.01); }
public void Set_Test() { var Jason = new Employee { Id = 17, Name = "Jason", Salary = 590000.00M }; Jason.Set("Name", "Segel"); Assert.AreEqual("Segel", Jason.Name); Jason.Set("Salary", "610000.00"); Assert.AreEqual(610000.00M, Jason.Salary); Jason.Set("Salary", 720000.00M); Assert.AreEqual(720000.00M, Jason.Salary); }