Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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;
            }
        }
Exemplo n.º 7
0
        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;
            }
        }