public static Student CreateTestStudent(string city) { //create student to run tests against Address address = CreateAddress(city); School school = new School { Address = address }; return new Student { School = school }; }
public void Updating_Intermediary_Object_Should_Update_Target() { Student.School.Address.City = "Paradise City"; Assert.AreEqual("Paradise City", Student.SchoolCity); //create a different school School school = new School(); school.Address = new Address {City = "Sin City"}; //assign the school to the student Student.School = school; //replacing the school triggered the binding Assert.AreEqual("Sin City", Student.SchoolCity); }