public void ShouldDoNothingWhenSettingPropertyToNullDataContext()
        {
            var target = new FrameworkElement();

            target.DataContext = null;
            var adapter = new DataContextPropertyAdapter(target, "Property");

            adapter.SetValue("AnotherPropertyValue");
        }
        public void ShouldSetValueToDataContextProperty()
        {
            var dataContext = new DataContext {
                Property = "OldPropertyValue"
            };
            var target = new FrameworkElement();

            target.DataContext = dataContext;
            var adapter = new DataContextPropertyAdapter(target, "Property");

            adapter.SetValue("NewPropertyValue");

            Assert.AreEqual("NewPropertyValue", dataContext.Property);
        }
        public void ShouldNotSetValueToPropertyOfOldDataContextAfterItChanges()
        {
            var target      = new FrameworkElement();
            var dataContext = new DataContext {
                Property = "PropertyValue"
            };

            target.DataContext = dataContext;
            var adapter = new DataContextPropertyAdapter(target, "Property");

            target.DataContext = new DataContext {
                Property = "OtherPropertyValue"
            };
            adapter.SetValue("AnotherPropertyValue");

            Assert.AreEqual("PropertyValue", dataContext.Property);
        }