public void TestGetPropertyValue_ThroughRelationship()
        {
            //---------------Set up test pack-------------------
            Car car1 = new Car();
            car1.CarRegNo = "5";

            Engine engine1 = new Engine();
            engine1.CarID = car1.CarID;
            engine1.EngineNo = "20";

            ITransactionCommitter committer = BORegistry.DataAccessor.CreateTransactionCommitter();
            committer.AddBusinessObject(car1);
            committer.AddBusinessObject(engine1);
            committer.CommitTransaction();

            //---------------Assert PreConditions---------------            
            //---------------Execute Test ----------------------
            object carregno = engine1.GetPropertyValue(new Source("Car"), "CarRegNo");
            //---------------Test Result -----------------------
            Assert.AreEqual(car1.CarRegNo, carregno);
            //---------------Tear Down -------------------------     
        }
        public void TestDereferenceRelatedObjects()
        {
            //The Car has a single relationship to engine. The car->engine relationship is marked 
            // as a dereference related relationship.
            BORegistry.DataAccessor = new DataAccessorInMemory();
            //---------------Set up test pack-------------------

            Car car = new Car();
            car.SetPropertyValue("CarRegNo", "NP32459");
            car.Save();

            Engine engine = new Engine();

            engine.SetPropertyValue("EngineNo", "NO111");
            const string carIDProp = "CarID";
            engine.SetPropertyValue(carIDProp, car.GetPropertyValue(carIDProp));
            engine.Save();

            BORegistry.DataAccessor.BusinessObjectLoader.Refresh(engine);
            Assert.AreSame(engine.GetCar(), car);

            //---------------Execute Test ----------------------
            car.MarkForDelete();
            car.Save();

            //---------------Test Result -----------------------
            Assert.IsNull(engine.GetPropertyValue(carIDProp));
            Assert.IsNull(engine.GetCar());
            //---------------Test TearDown -----------------------
        }
 public void TestGetPropertyValue_NullSource()
 {
     //---------------Set up test pack-------------------
     Engine engine1 = new Engine();
     engine1.EngineNo = "20";
     //---------------Assert PreConditions---------------            
     //---------------Execute Test ----------------------
     object engineNo = engine1.GetPropertyValue(null, "EngineNo");
     //---------------Test Result -----------------------
     Assert.AreEqual(engine1.EngineNo, engineNo);
     //---------------Tear Down -------------------------     
 }