public void ShouldGetNoValueWhenDataContextIsNull() { var target = new FrameworkElement(); target.DataContext = null; var adapter = new DataContextPropertyAdapter(target, "Property"); var value = adapter.GetValue(); Assert.AreSame(SettingsConstants.NoValue, value); }
public void ShouldGetValueFromDataContextProperty() { var target = new FrameworkElement(); target.DataContext = new DataContext { Property = "PropertyValue" }; var adapter = new DataContextPropertyAdapter(target, "Property"); var value = adapter.GetValue(); Assert.AreEqual("PropertyValue", value); }