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 Test1()
        {
            var file = new FileEmu();

            Assert.IsFalse(file.Exists("aaa.txt"));

            file.AddFile("aaa.txt", "あいうえお", Encoding.GetEncoding("shift-jis"));
            Assert.IsTrue(file.Exists("aaa.txt"));

            Assert.AreEqual("あいうえお", file.ReadAllText("aaa.txt", Encoding.GetEncoding("shift-jis")));

            file.WriteAllText("aaa.txt", "かきくけこ", Encoding.GetEncoding("shift-jis"));
            Assert.AreEqual("かきくけこ", file.ReadAllText("aaa.txt", Encoding.GetEncoding("shift-jis")));
        }
        public void WriteAllBytesTest()
        {
            var path = @"z:\temp\aaa.txt";
            var text = "あいうえお";
            var encoding = Encoding.GetEncoding("shift-jis");

            var file = new FileEmu();

            file.WriteAllBytes(path, encoding.GetBytes(text));

            Assert.AreEqual(text, file.ReadAllText(path, encoding));
        }
        public void OpenWriteTest()
        {
            var path = @"z:\temp\aaa.txt";
            var text = "あいうえお";

            var file = new FileEmu();

            using (Stream stream = file.OpenWrite(path))
            {
                byte[] data = Encoding.GetEncoding("shift-jis").GetBytes(text);
                stream.Write(data, 0, data.Length);
            }

            Assert.AreEqual(text, file.ReadAllText(path, Encoding.GetEncoding("shift-jis")));
        }