public void OtherClassShouldNotApplyDefault() { var style = new DefaultStyleProvider(); var provider = (IStyleProvider)style; style.Add <Button>(null, c => c.Visible = false); var label = new Label(); Assert.IsTrue(label.Visible); provider.ApplyDefault(label); Assert.IsTrue(label.Visible); }
public void OtherClassWithStyleShouldNotApply() { var style = new DefaultStyleProvider(); var provider = (IStyleProvider)style; style.Add <Button>("style", c => c.Visible = false); var label = new Label(); Assert.IsTrue(label.Visible); provider.ApplyStyle(label, "style"); Assert.IsTrue(label.Visible); }
public void BaseClassWithStyleShouldApply() { var style = new DefaultStyleProvider(); var provider = (IStyleProvider)style; style.Add <Control>("style", c => c.Visible = false); var label = new Label(); Assert.IsTrue(label.Visible); provider.ApplyStyle(label, "style"); Assert.IsFalse(label.Visible); }
public void BaseClassShouldApplyDefault() { var style = new DefaultStyleProvider(); var provider = (IStyleProvider)style; style.Add <Control>(null, c => c.Visible = false); var label = new Label(); Assert.IsTrue(label.Visible); provider.ApplyDefault(label); Assert.IsFalse(label.Visible); }
public void HandlerWithStyleShouldApply() { var style = new DefaultStyleProvider(); var provider = (IStyleProvider)style; style.Add <StyledWidgetHandler>("style", h => h.SomeProperty = true); var styledWidget = new StyledWidget(); Assert.IsFalse(styledWidget.SomeProperty); provider.ApplyStyle(styledWidget.Handler, "style"); Assert.IsTrue(styledWidget.SomeProperty); }
public void WidgetShouldApplyDefault() { var style = new DefaultStyleProvider(); style.Add <StyledWidget>(null, h => h.SomeProperty = true); var oldProvider = Style.Provider; Style.Provider = style; try { var styledWidget = new StyledWidget(); Assert.IsTrue(styledWidget.SomeProperty); } finally { Style.Provider = oldProvider; } }
public void HandlerWithStyleShouldApply() { var style = new DefaultStyleProvider(); style.Add <StyledWidgetHandler>("style", h => h.SomeProperty = true); var oldProvider = Style.Provider; Style.Provider = style; try { var styledWidget = new StyledWidget(); Assert.IsFalse(styledWidget.SomeProperty); styledWidget.Style = "style"; Assert.IsTrue(styledWidget.SomeProperty); } finally { Style.Provider = oldProvider; } }