Exemplo n.º 1
0
            public void Set_ListView_List()
            {
                var testRootTreeNode = new TreeNode("MyTestNode")
                {
                    Tag = _rootEntry
                };

                _mockForm.Stub(x => x.DirectoryTreeViewActiveAfterSelectNode)
                .Return(testRootTreeNode);

                // Directory ListView gets children of root
                object listViewListArg = null;

                _mockDirectoryListViewHelper.Stub(x => x.SetList(Arg <List <DirEntry> > .Is.Anything))
                .Return(1)
                .WhenCalled(a => listViewListArg = a.Arguments[0]);

                _sutPresenter.DirectoryTreeViewAfterSelect();

                var list = (List <DirEntry>)listViewListArg;

                Assert.That(list, Is.Not.Null);
                Assert.That(list.Count, Is.EqualTo(1), "The list set on ListViewHelper wasnt expected");
                Assert.That(list[0].Path, Is.EqualTo("Test"), "The list set on ListViewHelper wasnt expected");

                var args = _mockForm
                           .GetArgumentsForCallsMadeOn(x => x.SetDirectoryPathTextbox = Arg <string> .Is.Anything);
                var pathTextBoxValue = (string)(args[0][0]);

                Assert.That(pathTextBoxValue, Is.EqualTo(@"T:\"));
            }
Exemplo n.º 2
0
        // ReSharper restore LocalizableElement

        protected void MockTreeViewAfterSelect(CDEWinFormPresenter presenter)
        {
            _mockForm.Stub(x => x.DirectoryTreeViewSelectedNode = Arg <TreeNode> .Is.Anything)
            .WhenCalled(a =>
            {
                _treeViewAfterSelectNode = (TreeNode)a.Arguments[0];
                _mockForm.Stub(x => x.DirectoryTreeViewActiveAfterSelectNode)
                .Repeat.Times(1)
                .Return(_treeViewAfterSelectNode);
                presenter.DirectoryTreeViewAfterSelect();
            });
        }