public void IsExisting_Id()
        {
            var parent = new ScopedNameResolver();
            var sut    = new ScopedNameResolver(parent);

            parent.Register("a", new Query());
            sut.Register("b", new Query());

            Assert.True(sut.IsExisting("a"));
            Assert.False(sut.IsExistingInCurrentScope("a"));
            Assert.True(sut.IsExisting("b"));
            Assert.True(sut.IsExistingInCurrentScope("b"));

            Assert.True(parent.IsExisting("a"));
            Assert.True(parent.IsExistingInCurrentScope("a"));
        }
        public void IsExisting_Type()
        {
            var parent = new ScopedNameResolver();
            var sut    = new ScopedNameResolver(parent);

            parent.Register(Type("A"), new Query());
            sut.Register(Type("B"), new Query());

            Assert.True(sut.IsExisting(Type("A")));
            Assert.False(sut.IsExistingInCurrentScope(Type("A")));
            Assert.True(sut.IsExisting(Type("B")));
            Assert.True(sut.IsExistingInCurrentScope(Type("B")));

            Assert.True(parent.IsExisting(Type("A")));
            Assert.True(parent.IsExistingInCurrentScope(Type("A")));
        }
        public void DefaultValues()
        {
            var sut = new ScopedNameResolver();

            Assert.False(sut.IsExisting(TypeUnknown));
            Assert.NotNull(sut.BoundNames);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }
        public void RegisterId()
        {
            var q = SomeQuery();

            var sut = new ScopedNameResolver();

            sut.Register("x", q);

            Assert.True(sut.IsExisting("x"));
            Assert.AreEqual(q, sut.Find("x"));
        }
        public void RegisterType()
        {
            var q = SomeQuery();

            var sut = new ScopedNameResolver();

            sut.Register(TypeUnknown, q);

            Assert.True(sut.IsExisting(TypeUnknown));
            Assert.AreEqual(q, sut.Find(TypeUnknown));
        }
        public void LookupWorksInParentScope_Id()
        {
            var q = SomeQuery();

            var parent = new ScopedNameResolver();

            parent.Register("x", q);
            var sut = new ScopedNameResolver(parent);

            Assert.True(sut.IsExisting("x"));
            Assert.AreEqual(q, sut.Find("x"));
        }