示例#1
0
        public void Run_WhenRelPathUsingDotIsFile_RelNameIsListed()
        {
            var output = new StringWriter();

            var ls = new ListFileSystem(output, @".\foo.txt");

            MFile.GetAttributesString = (fileName) => FileAttributes.Normal;

            ls.Run();

            Assert.AreEqual(".\\foo.txt\r\n", output.ToString());
        }
示例#2
0
        public void List_WhenPathIsTooLong_DisplaysError()
        {
            var output = new StringWriter();

            const string targetFileName = @"L:\thisistoolong";

            var ls = new ListFileSystem(output, targetFileName);

            MFile.GetAttributesString = (fileName) => { throw new PathTooLongException(); };

            ls.Run();

            Assert.AreEqual("ls: cannot access L:\\thisistoolong: No such file or directory\r\n", output.ToString());
        }
示例#3
0
        public void List_WhenRelDirDoesNotExist_DisplaysError()
        {
            StringWriter output = new StringWriter();

            const string targetFileName = @"bar";

            ListFileSystem ls = new ListFileSystem(output, targetFileName);

            MFile.GetAttributesString = (fileName) => { throw new DirectoryNotFoundException(); };

            ls.Run();

            Assert.AreEqual("ls: cannot access bar: No such file or directory\r\n", output.ToString());
        }
示例#4
0
        public void List_WhenFileDoesNotExist_DisplaysError()
        {
            var output = new StringWriter();

            const string targetFileName = @"L:\foo.txt";

            var ls = new ListFileSystem(output, targetFileName);

            MFile.GetAttributesString = (fileName) => { throw new FileNotFoundException(); };

            ls.Run();

            Assert.AreEqual("ls: cannot access L:\\foo.txt: No such file or directory\r\n", output.ToString());
        }