Пример #1
0
        public OutlineNode(ITestPart part, Icon icon)
        {
            Focusable = true;

            Part = part;
            IsExpanded = true;
            Holder = part as IPartHolder;

            Header = new StackPanel().Horizontal().Configure(x =>
            {
                _textBlock = x.Add<TextBlock>();
            });

            Icon = icon;

            this.BindControlAnd(Key.M).To(() =>
            {
                if (ContextMenu != null)
                {
                    ContextMenu.PlacementTarget = this;
                    ContextMenu.VerticalOffset = 5;
                    ContextMenu.HorizontalOffset = 20;
                    ContextMenu.Placement = PlacementMode.RelativePoint;
                    ContextMenu.IsOpen = true;
                }
            });
        }
Пример #2
0
        public OutlineNode(ITestPart part, Icon icon)
        {
            Focusable = true;

            Part       = part;
            IsExpanded = true;
            Holder     = part as IPartHolder;

            Header = new StackPanel().Horizontal().Configure(x =>
            {
                _image = x.Add <Image>();
            });

            Icon = icon;

            this.BindControlAnd(Key.M).To(() =>
            {
                if (ContextMenu != null)
                {
                    ContextMenu.PlacementTarget  = this;
                    ContextMenu.VerticalOffset   = 5;
                    ContextMenu.HorizontalOffset = 20;
                    ContextMenu.Placement        = PlacementMode.RelativePoint;
                    ContextMenu.IsOpen           = true;
                }
            });
        }
Пример #3
0
        public void SelectNodeFor(ITestPart part)
        {
            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());
            //moveNext();
            //moveNext();
            //moveNext();
            //moveNext();
            //moveNext();

            _topNode.IsSelected = false;
            var parent = _topNode.Parent as UIElement;
            parent.Focus();
            parent.InvalidateVisual();
            OutlineNode node = _topNode.Find(n => n.Part == part);
            node.BringIntoView();
            node.IsSelected = true;
            node.Focus();
            //node.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //moveNext();
            return;

            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());

            node.Focus();

            //parent.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //Keyboard.FocusedElement.As<UIElement>().MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //Keyboard.FocusedElement.As<UIElement>().MoveFocus(new TraversalRequest(FocusNavigationDirection.Previous));

            //node.IsSelected = true;
            //node.Focus();
            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());
        }
 protected void assertCurrentNode(ITestPart part, Icon icon, string text)
 {
     OutlineNode outlineNode = treeBuilder.LastNode;
     outlineNode.Part.ShouldBeTheSameAs(part);
     outlineNode.Icon.ShouldEqual(icon);
     outlineNode.HeaderText().ShouldEqual(text);
 }
Пример #5
0
        protected void assertCurrentNode(ITestPart part, Icon icon, string text)
        {
            OutlineNode outlineNode = treeBuilder.LastNode;

            outlineNode.Part.ShouldBeTheSameAs(part);
            outlineNode.Icon.ShouldEqual(icon);
            outlineNode.HeaderText().ShouldEqual(text);
        }
Пример #6
0
 public void ConfigureRearrangeCommands(OutlineNode node, IPartHolder holder, ITestPart part)
 {
     node.BindControlAnd(Key.Up).To(() => _controller.MoveUp(part, holder)).Menu("Move Up", Icon.UpArrow);
     node.BindControlAnd(Key.PageUp).To(() => _controller.MoveToTop(part, holder)).Menu("Move to Top", Icon.UpArrow);
     node.BindControlAnd(Key.Down).To(() => _controller.MoveDown(part, holder)).Menu("Move Down", Icon.DownArrow);
     node.BindControlAnd(Key.PageDown).To(() => _controller.MoveToBottom(part, holder)).Menu("Move to Bottom", Icon.DownArrow);
     node.Bind(Key.Delete).To(() => _controller.Remove(part, holder)).Menu("Delete", Icon.Delete);
 }
Пример #7
0
        private void withNewLeaf(ITestPart part, Icon icon, Action <OutlineNode> configure)
        {
            var node = new OutlineNode(part, icon);

            configure(node);
            CurrentNode.Items.Add(node);
            LastNode = node;
        }
Пример #8
0
        public void ExecuteWithFixture <T>(StepLeaf leaf, ITestPart exceptionTarget) where T : IFixture
        {
            LoadFixture <T>(exceptionTarget);

            leaf.AcceptVisitor(this);

            RevertFixture(exceptionTarget);
        }
Пример #9
0
        public void LoadFixture <T>(ITestPart part) where T : IFixture
        {
            var fixture = RetrieveFixture <T>();



            LoadFixture(fixture, part);
        }
Пример #10
0
        private void addChildSteps(IStep parent, INode sectionNode)
        {
            StepLeaf childSteps = parent.LeafFor(sectionNode.Name);

            sectionNode.ForEachChild(childStepNode =>
            {
                ITestPart child = ReadPart(childStepNode);
                childSteps.Add(child);
            });
        }
Пример #11
0
        private Token tokenFor(ITestPart part)
        {
            Token token = _tokens.Find(t => t.Part == part);

            if (token == null)
            {
                throw new ArgumentOutOfRangeException("Could not find this Part in the TokenizedTest");
            }
            return(token);
        }
Пример #12
0
        public void LoadFixture(IFixture fixture, ITestPart part)
        {
            if (part == null)
            {
                throw new ArgumentNullException("part");
            }

            performAction(part, () => fixture.SetUp(this));

            _fixtures.Push(fixture);
        }
Пример #13
0
        public int OneBasedIndexOf(ITestPart part)
        {
            int index = _tokens.FindIndex(t => t.Part == part);

            if (index >= 0)
            {
                return(index + 1);
            }

            throw new ArgumentOutOfRangeException("Could not find this Part in the TokenizedTest");
        }
Пример #14
0
        public Section ReadSection(INode element)
        {
            var section = new Section(element.Name);
            var adder   = new SectionAdder(section);

            element.ForEachChild(node =>
            {
                ITestPart part = ReadPart(node);
                part.AcceptVisitor(adder);
            });

            return(section);
        }
Пример #15
0
 private void performAction(ITestPart part, Action continuation)
 {
     try
     {
         continuation();
     }
     catch (Exception ex)
     {
         _listener.Exception(ex.ToString());
         IncrementExceptions();
         ResultsFor(part).CaptureException(ex.ToString());
     }
 }
Пример #16
0
        public void LoadFixture(string fixtureKey, ITestPart part)
        {
            var results = ResultsFor(part);

            try
            {
                var fixture = _container.GetInstance <IFixture>(fixtureKey);
                LoadFixture(fixture, part);
            }
            catch (StructureMapException e)
            {
                _fixtureIsInvalid = true;
                _listener.Exception(e.ToString());

                if (e.ErrorCode == 200)
                {
                    results.CaptureException("Unable to find a Fixture named '{0}'".ToFormat(fixtureKey));
                    IncrementSyntaxErrors();
                }
                else
                {
                    IncrementExceptions();
                    if (e.InnerException != null)
                    {
                        results.CaptureException(e.InnerException.ToString());
                    }
                    else
                    {
                        results.CaptureException(e.ToString());
                    }
                }
            }
            catch (Exception e)
            {
                _fixtureIsInvalid = true;
                _listener.Exception(e.ToString());
                results.CaptureException(e.ToString());
                IncrementExceptions();
            }
        }
Пример #17
0
        public void RevertFixture(ITestPart part)
        {
            if (_fixtureIsInvalid)
            {
                _fixtureIsInvalid = false;
                return;
            }

            if (part == null)
            {
                throw new ArgumentNullException("part");
            }

            IFixture fixture = _fixtures.Pop();

            if (fixture != null)
            {
                performAction(part, fixture.TearDown);
            }

            _fixtureIsInvalid = false;
        }
Пример #18
0
        public void SelectNodeFor(ITestPart part)
        {
            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());
            //moveNext();
            //moveNext();
            //moveNext();
            //moveNext();
            //moveNext();

            _topNode.IsSelected = false;
            var parent = _topNode.Parent as UIElement;

            parent.Focus();
            parent.InvalidateVisual();
            OutlineNode node = _topNode.Find(n => n.Part == part);

            node.BringIntoView();
            node.IsSelected = true;
            node.Focus();
            //node.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //moveNext();
            return;


            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());

            node.Focus();

            //parent.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //Keyboard.FocusedElement.As<UIElement>().MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            //Keyboard.FocusedElement.As<UIElement>().MoveFocus(new TraversalRequest(FocusNavigationDirection.Previous));

            //node.IsSelected = true;
            //node.Focus();
            //_topNode.Parent.CallOn<UIElement>(e => e.Focus());
        }
Пример #19
0
 public void Remove(ITestPart part, IPartHolder holder)
 {
     configure(holder, h => h.Remove(part));
 }
Пример #20
0
 public void ConfigureRearrangeCommands(OutlineNode node, IPartHolder holder, ITestPart part)
 {
     node.BindControlAnd(Key.Up).To(() => _controller.MoveUp(part, holder)).Menu("Move Up", Icon.UpArrow);
     node.BindControlAnd(Key.PageUp).To(() => _controller.MoveToTop(part, holder)).Menu("Move to Top", Icon.UpArrow);
     node.BindControlAnd(Key.Down).To(() => _controller.MoveDown(part, holder)).Menu("Move Down", Icon.DownArrow);
     node.BindControlAnd(Key.PageDown).To(() => _controller.MoveToBottom(part, holder)).Menu("Move to Bottom", Icon.DownArrow);
     node.Bind(Key.Delete).To(() => _controller.Remove(part, holder)).Menu("Delete", Icon.Delete);
 }
 public virtual void FinishPart(ITestPart part)
 {
     _progression.IncrementProgress(part);
     Publish();
 }
Пример #22
0
 public void MoveUp(ITestPart part, IPartHolder holder)
 {
     configure(holder, h => h.MoveUp(part));
     _treeService.SelectNodeFor(part);
 }
Пример #23
0
 public static void Add(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.Add(part);
 }
Пример #24
0
        public string PathOf(ITestPart part)
        {
            Token token = tokenFor(part);

            return(token.Description);
        }
Пример #25
0
 public static void MoveDown(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.MoveDown(part);
 }
Пример #26
0
 public static void Remove(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.Remove(part);
 }
Пример #27
0
 public virtual void FinishPart(ITestPart part)
 {
     _progression.IncrementProgress(part);
     Publish();
 }
Пример #28
0
 public void IncrementProgress(ITestPart part)
 {
     _progress++;
 }
Пример #29
0
 public void ExecuteWithFixture <T>(StepLeaf leaf, ITestPart exceptionTarget) where T : IFixture
 {
 }
Пример #30
0
 public StepResults ResultsFor(ITestPart part)
 {
     return(_results[part]);
 }
Пример #31
0
 public void Add(ITestPart testPart)
 {
     _parts.Add(testPart);
 }
Пример #32
0
 private void withNewNode(ITestPart part, Icon icon, Action<OutlineNode> configure)
 {
     var node = new OutlineNode(part, icon);
     configure(node);
     CurrentNode.Items.Add(node);
     LastNode = node;
     _nodes.Push(node);
 }
Пример #33
0
 public static void MoveToBottom(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.MoveToBottom(part);
 }
 public void Add(ITestPart testPart)
 {
     _parts.Add(testPart);
 }
Пример #35
0
 public static void Remove(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.Remove(part);
 }
Пример #36
0
 public static void MoveUp(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.MoveUp(part);
 }
Пример #37
0
 public static void Add(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.Add(part);
 }
Пример #38
0
 public void Start(ITestPart part)
 {
     _current = tokenFor(part);
 }
Пример #39
0
 public static void MoveToBottom(this IPartHolder holder, ITestPart part)
 {
     holder.Parts.MoveToBottom(part);
 }
Пример #40
0
 public void Add(ITestPart part)
 {
     _parts.Add(part);
 }
 public virtual void StartPart(ITestPart part)
 {
     _progression.Start(part);
     Publish();
 }
Пример #42
0
 public void Add(ITestPart testPart)
 {
     inner.Add(testPart);
 }
Пример #43
0
 public void MoveToBottom(ITestPart part, IPartHolder holder)
 {
     configure(holder, h => h.MoveToBottom(part));
     _treeService.SelectNodeFor(part);
 }
Пример #44
0
 public void Add(ITestPart testPart)
 {
     inner.Add(testPart);
 }
Пример #45
0
 public virtual void StartPart(ITestPart part)
 {
     _progression.Start(part);
     Publish();
 }