public void TestClassFunction() { var r = new Root(); var s = new Stem(); r.Id = 1; Assert.AreEqual(0, s.ParentId); s.GetParentId = () => { return(r.Id); }; s.Test(); Assert.AreEqual(1, s.ParentId); }