Exemplo n.º 1
0
        public void RegisterOneChildInNameScope()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope <DummyClass>();

            var actualInstance = Loader.FromString(File.LoadAsString(@"Xaml\Dummy\ChildInNameScope.xaml"));
            var childInScope   = ((DummyObject)actualInstance).Find("MyObject");

            Assert.IsType(typeof(ChildClass), childInScope);
        }
Exemplo n.º 2
0
        public void RegisterOneChildInNameScopeWithoutDirective()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope <DummyClass>();

            var actualInstance = Loader.FromString(Dummy.ChildInNamescopeNoNameDirective);
            var childInScope   = ((DummyObject)actualInstance).Find("MyObject");

            Assert.IsType(typeof(ChildClass), childInScope);
        }
Exemplo n.º 3
0
        public void RegisterOneChildInNameScope()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope <DummyClass>();

            sut.Process(source.ChildInNameScope);
            var actual       = sut.Result;
            var childInScope = ((DummyObject)actual).Find("MyObject");

            Assert.IsType(typeof(ChildClass), childInScope);
        }
Exemplo n.º 4
0
        public void RegisterChildInDeeperNameScope()
        {
            RuntimeTypeSource.ClearNamescopes();
            RuntimeTypeSource.EnableNameScope <Window>();

            sut.Process(source.ChildInDeeperNameScope);
            var actual     = sut.Result;
            var textBlock1 = ((Window)actual).Find("MyTextBlock");
            var textBlock2 = ((Window)actual).Find("MyOtherTextBlock");

            Assert.IsType(typeof(TextBlock), textBlock1);
            Assert.IsType(typeof(TextBlock), textBlock2);
        }