コード例 #1
0
        public void EnteringInitialNameModeBeginsEdit()
        {
            var folder = new LibraryFolderNode(_unitTestDispatcher.Dispatcher, _eventAggregator);

            folder.EnterInitialNameMode();

            Assert.That(folder.EditLabel, Is.True);
        }
コード例 #2
0
        public void NewFolderSpecifiesParent()
        {
            var folder = new LibraryFolderNode(_unitTestDispatcher.Dispatcher, _eventAggregator)
            {
                Id   = TestIds.GetId(0),
                Path = new [] { "Parent" }
            };

            folder.NewFolder.Execute(null);

            Assert.That(_listener.Requests, Is.EqualTo("AddFolder Parent\\\r\n"));
        }
コード例 #3
0
        public void OutsideInitialNameModeCancelEditDoesNotRequestDelete()
        {
            var folder = new LibraryFolderNode(_unitTestDispatcher.Dispatcher, _eventAggregator)
            {
                Id = TestIds.GetId(0)
            };

            folder.BeginEditLabel.Execute(null);
            folder.CancelEditLabel.Execute(null);

            Assert.That(_listener.Requests, Is.EqualTo("Select Id0\r\n"));
        }
コード例 #4
0
        public void SetUp()
        {
            _eventAggregator = new UnitTestEventAggregator();
            _listener        = new EventListener();
            _eventAggregator.AddListener(_listener);
            _unitTestDispatcher = new UnitTestDispatcher();
            _node      = new LibraryFileNode(_unitTestDispatcher.Dispatcher, _eventAggregator);
            _node.Id   = TestIds.GetId(0);
            _node.Id   = TestIds.GetId(0);
            _node.Name = "original name";

            _folderNode = new LibraryFolderNode(_unitTestDispatcher.Dispatcher, _eventAggregator)
            {
                Id   = TestIds.GetId(1),
                Path = new [] { "Parent" }
            };
        }
コード例 #5
0
ファイル: MockLibraryView.cs プロジェクト: PSL-Practice/Imb
        private LibraryViewNode FindParentNode(string[] path, IList <LibraryViewNode> items, LibraryViewNode parentNode)
        {
            if (path.Length == 0)
            {
                return(parentNode);
            }

            var parent = items.FirstOrDefault(i => i.Name == path[0] && i is LibraryFolderNode);

            if (parent == null)
            {
                parent = new LibraryFolderNode(_dispatcher, _eventAggregator)
                {
                    Id = Guid.NewGuid(), Name = path[0], Parent = parentNode, Path = parentNode == null ? null : parentNode.GetPathForChild()
                };
                items.Add(parent);
            }

            return(FindParentNode(path.Skip(1).ToArray(), parent.Children, parent));
        }
コード例 #6
0
        public void ByDefaultFolderIsNotInLabelEditMode()
        {
            var folder = new LibraryFolderNode(_unitTestDispatcher.Dispatcher, _eventAggregator);

            Assert.That(folder.EditLabel, Is.False);
        }