public void BindingPathTest() { var MyTopObject = new { PropertyC = "YES!!" }; var MySecondObject = new { PropertyB = MyTopObject }; var MyFirstObject = new { PropertyA = MySecondObject }; Binding binding = new Binding("PropertyA.PropertyB.PropertyC", MyFirstObject); Assert.AreEqual("YES!!", binding.Value); }
public void BindingPathWithPropertyBChangedTest() { ClassA a = new ClassA(); a.PropertyA.PropertyB.PropertyC = "The last property"; Binding binding = new Binding("PropertyA.PropertyB.PropertyC", a); Assert.AreEqual("The last property", binding.Value); a.PropertyA.PropertyB = new ClassC() { PropertyC = "Change here" }; Assert.AreEqual("Change here", binding.Value); a.PropertyA.PropertyB.PropertyC = "Again!"; Assert.AreEqual("Again!", binding.Value); a.PropertyA = new ClassB() { PropertyB = new ClassC() { PropertyC = "The last test" } }; Assert.AreEqual("The last test", binding.Value); }