public void GetFilesShouldListFiles() { server = GetFtpServer(); server.Start(); File.Create(Path.Combine(ftpHomeDirectory, "someFile.csv")).Dispose(); File.Create(Path.Combine(ftpHomeDirectory, "TestFile1.txt")).Dispose(); server.GetFiles(".").ShouldAllBeEquivalentTo(new[] { "someFile.csv", "TestFile1.txt" }); }
public void UploadingFileShouldUploadFile() { server = GetFtpServer(); server.Start(); var ftpRequest = (FtpWebRequest)WebRequest.Create(@"ftp://localhost:3435/someDirectory/someFile.csv"); ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; using (var request = ftpRequest.GetRequestStream()) { using (var writer = new StreamWriter(request)) { writer.WriteLine("test"); } } server.GetFiles("someDirectory").ShouldAllBeEquivalentTo(new[] { "someFile.csv" }); }
public void GetFilesShouldReturnFiles(FtpServer server, string path, IEnumerable <string> expectedFiles) { server.GetFiles(path).ShouldAllBeEquivalentTo(expectedFiles); }