Ejemplo n.º 1
0
        private void ReadToIndexDirectory()
        {
            // Reset values before we do anything
            max_obj     = -1;
            min_obj     = -1;
            current_obj = 0;
            obj_count   = 0;

            foreach (string filename in DirectoryWalker.GetFiles(path))
            {
                int cur_index;

                try {
                    cur_index = Convert.ToInt32(Path.GetFileName(filename));
                } catch {
                    continue;
                }

                if (max_obj == -1 || min_obj == -1)
                {
                    max_obj = min_obj = cur_index;
                }
                else if (cur_index < min_obj)
                {
                    min_obj = cur_index;
                }
                else if (cur_index > max_obj)
                {
                    max_obj = cur_index;
                }
                else
                {
                    continue;                     // This should _never_ happen
                }
                obj_count++;
            }

            current_obj = min_obj;
        }
        public void GetFiles_should_return_all_files_in_a_directory()
        {
            var files = DirectoryWalker.GetFiles(TestUtility.GetFixturePath("ndriven"));

            Assert.AreEqual(128, files.Count);
        }
        public void GetFiles_should_return_all_files_given_a_wildcard()
        {
            var files = DirectoryWalker.GetFiles(TestUtility.GetFixturePath("ndriven"), "*.cs");

            Assert.AreEqual(74, files.Count);
        }