Ejemplo n.º 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"));
        }
Ejemplo n.º 2
0
        public void Child_Scope_FindAsync_Should_Prefer_Own_Elements()
        {
            var scope        = new NameScope();
            var childScope   = new ChildNameScope(scope);
            var element      = new object();
            var childElement = new object();

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