예제 #1
0
        public void Child_Scope_Should_Not_Find_Control_In_Parent_Scope_Unless_Completed()
        {
            var scope      = new NameScope();
            var childScope = new ChildNameScope(scope);
            var element    = new object();

            scope.Register("foo", element);
            Assert.Null(childScope.Find("foo"));
            childScope.Complete();
            Assert.Same(element, childScope.Find("foo"));
        }
예제 #2
0
        public void Child_Scope_FindAsync_Should_Find_Elements_In_Parent_Scope_When_Child_Is_Completed()
        {
            var scope      = new NameScope();
            var childScope = new ChildNameScope(scope);
            var element    = new object();

            scope.Register("foo", element);
            FindAsync(childScope, "foo");
            Assert.Null(_found);
            childScope.Complete();
            Assert.Same(element, _found);
        }
예제 #3
0
        public void Child_Scope_Should_Prefer_Own_Elements()
        {
            var scope        = new NameScope();
            var childScope   = new ChildNameScope(scope);
            var element      = new object();
            var childElement = new object();

            scope.Register("foo", element);
            childScope.Register("foo", childElement);
            childScope.Complete();
            Assert.Same(childElement, childScope.Find("foo"));
        }