예제 #1
0
        public void FindStyleResource_Should_Find_Correct_Resource()
        {
            Border target;

            var tree = new Decorator
            {
                Styles = new Styles
                {
                    new Style
                    {
                        Resources = new Dictionary<string, object>
                        {
                            { "Foo", "foo resource" },
                            { "Bar", "overridden" },
                        }
                    }
                },
                Child = target = new Border
                {
                    Styles = new Styles
                    {
                        new Style
                        {
                            Resources = new Dictionary<string, object>
                            {
                                { "Bar", "again overridden" },
                            }
                        },
                        new Style
                        {
                            Resources = new Dictionary<string, object>
                            {
                                { "Bar", "bar resource" },
                            }
                        }
                    }
                }
            };

            Assert.Equal("foo resource", target.FindStyleResource("Foo"));
            Assert.Equal("bar resource", target.FindStyleResource("Bar"));
        }
예제 #2
0
        public void FindStyleResource_Should_Return_UnsetValue_For_Not_Found()
        {
            Border target;

            var tree = target = new Border
            {
                Styles = new Styles
                    {
                        new Style
                        {
                            Resources = new Dictionary<string, object>
                            {
                                { "Foo", "foo" },
                            }
                        },
                    }
            };

            Assert.Equal(AvaloniaProperty.UnsetValue, target.FindStyleResource("Baz"));
        }