Esempio n. 1
0
        static void Main(string[] args)
        {
            List <Drive> listAll = DriveManager.GetAllDrives();

            string path               = "C:\\";
            string pathRec            = "C:\\";
            var    currentFolderItems = FolderManager.GetAllItemsForFolder(path);

            foreach (var item in listAll)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine("----------------------------------------------------------");

            foreach (var item in currentFolderItems)
            {
                Console.WriteLine(item.Name);
            }
            Console.WriteLine("----------------------------------------------------------");

            var items = GlobalFilesCalculation.GetFilesCount(pathRec);

            Console.WriteLine($"{items.FilesThatLessThan10Mb} -- " +
                              $"{items.FilesBetween10ANd50Mb} --" +
                              $"errors - {items.Errors} --" +
                              $"{items.FilesMoreThan100Mb}");

            Console.ReadKey();
        }
Esempio n. 2
0
        public JsonResult Get()
        {
            var listAll = DriveManager.GetAllDrives();

            Response.StatusCode = (int)HttpStatusCode.OK;
            return(Json(listAll));
        }
Esempio n. 3
0
        public void GetCountOfDrivers()
        {
            List <Drive> drives     = new List <Drive>();
            int          countDrive = 6;

            drives = DriveManager.GetAllDrives();

            Assert.That(drives.Count, Is.EqualTo(countDrive));
        }
Esempio n. 4
0
        public void GetCountForInanctiveDrives()
        {
            List <Drive> drives         = new List <Drive>();
            int          inactiveDrives = 2;

            drives = DriveManager.GetAllDrives();
            int inactDrives = drives.Where(c => c.IsReady == false).ToList().Count;

            Assert.That(inactiveDrives, Is.EqualTo(inactDrives));
        }
Esempio n. 5
0
        public void GetSizeForC()
        {
            List <Drive> drives    = new List <Drive>();
            long         diskCsize = 195;

            drives = DriveManager.GetAllDrives();
            long diskC = drives.Where(c => c.Name == "C:\\").First().TotalSize;

            Assert.That(diskCsize, Is.EqualTo(diskC));
        }
Esempio n. 6
0
        public void CheckSorting()
        {
            List <Drive> drives = new List <Drive>();
            bool         firstSizeMoreThanLast = true;

            drives = DriveManager.GetAllDrives();
            var  firstDrive = drives[0];
            var  lastDrive  = drives[drives.Count - 1];
            bool checkSize  = firstDrive.TotalSize > lastDrive.TotalSize;

            Assert.That(firstSizeMoreThanLast, Is.EqualTo(checkSize));
        }
Esempio n. 7
0
 public MainWindowViewModel()
 {
     Drives = new ObservableCollection <DriveInfo>(DriveManager.GetAllDrives());
 }