Ejemplo n.º 1
0
        private void Expand()
        {
            if (this.Type == DirectoryType.File)
            {
                return;
            }

            var children = DirService.GetDirectoryContents(this.Path);

            this.Children = new ObservableCollection <DirectoryItemViewModel>(
                children.Select(c => new DirectoryItemViewModel(c.Path, c.Type)));
        }
        public void DirService_CheckDirExists()
        {
            //Arrange
            string       tempFolder = TestResources.getGingerUnitTesterTempFolder(testFolderName);
            DirService   dirService = new DirService();
            GingerAction gingerAct  = new GingerAction();

            //Act
            dirService.DirExists(gingerAct, tempFolder);

            //Assert
            Assert.AreEqual("True", gingerAct.Output["DirExists"], "DirExists=True");
        }
        public void DirService_RunDirInfoCommand()
        {
            //Arrange
            string tempFolder = TestResources.GetTempFile(testFolderName);

            DirService   dirService = new DirService();
            GingerAction gingerAct  = new GingerAction();

            //Act
            dirService.DirInfo(gingerAct, tempFolder);

            //Assert
            Assert.IsNotNull(gingerAct.Output["DirInfo_Root"], "DirInfo_Root is not null");
            Assert.AreEqual(testFolderName, gingerAct.Output["DirInfo_Name"]);
        }
        public void DirService_DirListFileCount()
        {
            //Arrange
            string       tempFolder = TestResources.getGingerUnitTesterTempFolder(testFolderName);
            DirService   dirService = new DirService();
            GingerAction gingerAct  = new GingerAction();

            string tempFile1 = Path.Combine(tempFolder, "test1.txt");
            string tempFile2 = Path.Combine(tempFolder, "test2.txt");

            //Act
            CreateTempFileContents(tempFile1);
            CreateTempFileContents(tempFile2);
            dirService.DirList(gingerAct, tempFolder);

            //Assert
            Assert.AreEqual("2", gingerAct.Output["FileCount"], "FileCount=2");
        }
 public DirectoryStructureViewModel()
 {
     this.Drives = new ObservableCollection <DirectoryItemViewModel>(DirService.GetLogicalDrives()
                                                                     .Select(d => new DirectoryItemViewModel(d.Path, DirectoryType.Drive)));
 }