public void FE_Set_Style_Invalid_TargetType() { var fe = new TestFE1(); var style = new Style(typeof(Button)); Assert.ThrowsException <InvalidOperationException>(() => fe.Style = style); }
public void FE_AddLogicalChild_Parent() { var parent = new TestFE2(); var child = new TestFE1(); parent.Children.Add(child); parent.Children[0].Parent.Should().Be(parent); }
public void FE_AddLogicalChild_When_Child_Already_Has_Logical_Parent() { var parent = new TestFE2(); var child = new TestFE1(); parent.Children.Add(child); var newParent = new TestFE1(); Assert.ThrowsException <InvalidOperationException>(() => newParent.AddLogicalChild(child)); }
public void FE_Set_Style_Check_IsSealed() { var fe = new TestFE1(); var style = new Style(typeof(TestFE1)); style.IsSealed.Should().BeFalse(); fe.Style = style; style.IsSealed.Should().BeTrue(); }
public void FE_RemoveLogicalChild_When_Child_Is_Not_LogicalChild() { var parent = new TestFE2(); var child = new TestFE1(); parent.Children.Add(child); var otherParent = new TestFE1(); otherParent.RemoveLogicalChild(child); child.Parent.Should().Be(parent); }
private static TestFE1 TestFeWithStyle() { var fe = new TestFE1(); var style = new Style(typeof(TestFE1)); style.Setters.Add(new Setter(TestFE1.Prop1Property, 55d)); style.Setters.Add(new Setter(TestFE1.Prop2Property, null)); fe.Style = style; return(fe); }
public void FE_RemoveLogicalChild_Parent() { var parent = new TestFE2(); var child = new TestFE1(); parent.Children.Add(child); child.Parent.Should().Be(parent); parent.Children.Remove(child); child.Parent.Should().BeNull(); }
public void FE_Set_Style_When_Setter_Value_Is_Binding() { var fe = new TestFE1(); fe.DataContext = 100d; var style = new Style(typeof(TestFE1)); style.Setters.Add(new Setter(TestFE1.Prop1Property, new Binding())); fe.Style = style; fe.Prop1.Should().Be(100d); }