public void DeleteFileTest()
        {
            var encoding = Encoding.UTF8;
            var text = "aaaaaa";
            var client = new FtpClientMock();
            client.Host = "xxxx.xxx.xxx";
            client.AddFile("web/test", "aaa.txt", text, encoding);

            client.DeleteFile("web/test", "aaa.txt");

            Assert.IsFalse(client._dict.ContainsKey(client.GetUri("web/test", "aaa.txt")));
        }
        public void ListDirectoryDetailsTest()
        {
            /*
            05-10-10  02:03AM                    7 test.txt
            03-30-10  08:23PM                  151 web.config

            */
            var encoding = Encoding.UTF8;
            var text = "aaaaaa";
            var client = new FtpClientMock();
            client.Host = "xxxx.xxx.xxx";
            client.AddFile("web/test1", new FtpItem("a01.txt", new DateTime(2010, 1, 2, 3, 4, 5)), text, encoding);
            client.AddFile("web/test1", new FtpItem("a02.txt", new DateTime(2011, 6, 7, 15, 9, 10)), text, encoding);
            client.AddFile("web/test2", new FtpItem("a03.txt", new DateTime(2010, 1, 2, 3, 4, 5)), text, encoding);

            string s = client.ListDirectoryDetails("web/test1");

            Assert.AreEqual(
            @"01-02-10  03:04AM                    6 a01.txt
            06-07-11  03:09PM                    6 a02.txt
            ", s);
        }
        public void DownloadDataTest()
        {
            var path = @"z:\temp\aaa.txt";
            var text = "aaaa";
            var encoding = Encoding.UTF8;

            var file = new FileEmu();

            var client = new FtpClientMock();
            client.FileBase = file;
            client.Host = "xxxx.xxx.xxx";
            client.AddFile("web/test", "aaa.txt", text, encoding);

            client.DownloadFile("web/test", Path.GetFileName(path), Path.GetDirectoryName(path));

            Assert.AreEqual(text, file.ReadAllText(path, encoding));
        }
        public void ListDirectoryTest()
        {
            var encoding = Encoding.UTF8;
            var text = "aaaaaa";
            var client = new FtpClientMock();
            client.Host = "xxxx.xxx.xxx";
            client.AddFile("web/test1", "a01.txt", text, encoding);
            client.AddFile("web/test1", "a02.txt", text, encoding);
            client.AddFile("web/test1", "a03.txt", text, encoding);
            client.AddFile("web/test2", "a04.txt", text, encoding);
            client.AddFile("web/test2", "a05.txt", text, encoding);
            client.AddFile("web/test2", "a06.txt", text, encoding);

            string s = client.ListDirectory("web/test1");

            Assert.AreEqual(
            @"a01.txt
            a02.txt
            a03.txt
            ", s);
        }