コード例 #1
0
        public void true_if_matching()
        {
            var frame1 = new BuildFrame(typeof(IWidget), "red", typeof(ColorWidget));
            var frame2 = new BuildFrame(typeof(IWidget), "red", typeof(ColorWidget));
            var frame3 = new BuildFrame(typeof(IWidget), "green", typeof(ColorWidget));

            frame1.Contains(frame2).ShouldBeTrue();
            frame1.Contains(frame3).ShouldBeFalse();

            frame3.Attach(frame2);

            frame3.Contains(frame1).ShouldBeTrue();
        }
コード例 #2
0
        internal void Push(BuildFrame frame)
        {
            if (_root == null)
            {
                _root = _current = frame;
            }
            else
            {
                if (_root.Contains(frame))
                {
                    throw new StructureMapException(295, frame.ToString(), _root.ToStackString());
                }

                _current.Attach(frame);
                _current = frame;
            }
        }