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());
        }
        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());
        }
        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());
        }
        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());
        }
        public void ListFileSystem_constructs_notnull()
        {
            var ls = new ListFileSystem(new StringWriter(), string.Empty);

            Assert.IsNotNull(ls);
        }