Example #1
0
        public void HierarchyCanBeCreated()
        {
            var parent = new ScopedEnclosings();
            var sut    = new ScopedEnclosings(parent);

            Assert.AreEqual(parent, sut.Parent);
        }
Example #2
0
        public void DefaultValues()
        {
            var sut = new ScopedEnclosings();

            Assert.Null(sut.Parent);
            Assert.AreEqual(Names.UnknownType, sut.Type);
            Assert.AreEqual(Names.UnknownMethod, sut.Method);
        }
Example #3
0
        public void EnclosingsCanBeSet()
        {
            var sut = new ScopedEnclosings
            {
                Type   = Type("T"),
                Method = Method("M")
            };

            Assert.AreEqual(Type("T"), sut.Type);
            Assert.AreEqual(Method("M"), sut.Method);
        }
Example #4
0
        public void EnclosingsAreInferedFromHierarchy()
        {
            var parent = new ScopedEnclosings
            {
                Type   = Type("T"),
                Method = Method("M")
            };
            var sut = new ScopedEnclosings(parent);

            Assert.AreEqual(Type("T"), sut.Type);
            Assert.AreEqual(Method("M"), sut.Method);
        }
Example #5
0
        public void SettingEnclosingsDoesNotAffectHierarchy()
        {
            var parent = new ScopedEnclosings
            {
                Type   = Type("T"),
                Method = Method("M")
            };
            var sut = new ScopedEnclosings(parent)
            {
                Type   = Type("T2"),
                Method = Method("M2")
            };

            Assert.AreEqual(Type("T"), parent.Type);
            Assert.AreEqual(Method("M"), parent.Method);

            Assert.AreEqual(Type("T2"), sut.Type);
            Assert.AreEqual(Method("M2"), sut.Method);
        }