示例#1
0
        public void push_a_new_BuildFrame_onto_the_stack()
        {
            var root   = new BuildFrame(typeof(IWidget), "Root", typeof(ColorWidget));
            var frame1 = new BuildFrame(typeof(IWidget), "Frame1", typeof(ColorWidget));
            var frame2 = new BuildFrame(typeof(IWidget), "Frame2", typeof(ColorWidget));
            var stack  = new BuildStack();

            stack.Push(root);

            stack.Push(frame1);
            stack.Current.ShouldBeTheSameAs(frame1);
            stack.Parent.ShouldBeTheSameAs(root);
            stack.Root.ShouldBeTheSameAs(root);

            stack.Push(frame2);
            stack.Parent.ShouldBeTheSameAs(frame1);
            stack.Current.ShouldBeTheSameAs(frame2);
            stack.Root.ShouldBeTheSameAs(root);

            stack.Pop();
            stack.Parent.ShouldBeTheSameAs(root);
            stack.Current.ShouldBeTheSameAs(frame1);
            stack.Pop();
            stack.Current.ShouldBeTheSameAs(root);
        }
        protected override object build(Type pluginType, BuildSession session)
        {
            Current = session.BuildStack.Current;
            Root    = session.BuildStack.Root;

            return(new ColorRule("Red"));
        }
 internal void Pop()
 {
     _current = _current.Detach();
     if (_current == null)
     {
         _root = null;
     }
 }
示例#4
0
 public void Pop()
 {
     _current = _current.Detach();
     if (_current == null)
     {
         _root = null;
     }
 }
示例#5
0
        public void Create_build_stack_and_the_root_is_from_the_ctor()
        {
            var root  = new BuildFrame(typeof(IWidget), "Blue", typeof(ColorWidget));
            var stack = new BuildStack();

            stack.Push(root);

            stack.Root.ShouldBeTheSameAs(root);
        }
示例#6
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();
        }
示例#7
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;
            }
        }
        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;
            }
        }
示例#9
0
 internal void Pop()
 {
     _current = _current.Detach();
     if (_current == null) _root = null;
 }
示例#10
0
 public void Clear()
 {
     _current = _root = null;
 }
 public void Clear()
 {
     _current = _root = null;
 }
示例#12
0
        public void Push(BuildFrame frame)
        {
            if (_root == null)
            {
                _root = _current = frame;
            }
            else
            {
                if (_root.Contains(frame))
                {
                    // TODO -- do something about this
                    //throw new StructureMapException(295, frame.ToString(), _root.ToStackString());
                }

                _current.Attach(frame);
                _current = frame;
            }
        }
示例#13
0
 public void Pop()
 {
     _current = _current.Detach();
     if (_current == null) _root = null;
 }