public void Inactive_Bindings_Should_Not_Be_Made_Active_During_Style_Detach()
{
using var app = UnitTestApplication.Start(TestServices.RealStyler);
var root = new TestRoot
{
Styles =
{
new Style(x => x.OfType<Class1>())
{
Setters =
{
new Setter(Class1.FooProperty, new Binding("Foo")),
},
},
new Style(x => x.OfType<Class1>())
{
Setters =
{
new Setter(Class1.FooProperty, new Binding("Bar")),
},
}
}
};
var target = new Class1
{
DataContext = new
{
Foo = "Foo",
Bar = "Bar",
}
};
root.Child = target;
var values = new List<string>();
target.GetObservable(Class1.FooProperty).Subscribe(x => values.Add(x));
root.Child = null;
Assert.Equal(new[] { "Bar", "foodefault" }, values);
}