Example #1
0
        public async Task Should_present_file()
        {
            Program.Initialise();

            await ResourceHelpers.CreateFileWithContentAsync("level1/level2/level2content.txt", "Lorem ipsum dolor sit amet", Logger);

            var filesystemProvider = new FtpFileProvider(new FtpAdapterConfiguration
            {
                AdapterName = "ftp_filesystem",
                Host        = Program.FtpConfiguration.Host,
                Username    = Program.FtpConfiguration.Username,
                Password    = Program.FtpConfiguration.Password,
                Port        = Program.FtpConfiguration.Port,
                Directory   = "/"
            }, "level1/level2/level2content.txt");

            filesystemProvider.IsFile.Should().BeTrue();
            filesystemProvider.File.Should().NotBeNull();

            var bytes = await filesystemProvider.File.ReadToEndAsync();

            string contents = Encoding.UTF8.GetString(bytes);

            contents.Should().StartWith("Lorem ipsum");
        }
Example #2
0
        public void Should_give_deep_path()
        {
            Program.Initialise();
            var filesystemProvider = new FtpFileProvider(new FtpAdapterConfiguration
            {
                AdapterName = "ftp_filesystem",
                Host        = Program.FtpConfiguration.Host,
                Username    = Program.FtpConfiguration.Username,
                Password    = Program.FtpConfiguration.Password,
                Port        = Program.FtpConfiguration.Port,
                Directory   = "/"
            }, "level1/level2/");

            filesystemProvider.Should().BeOfType <FtpFileProvider>();
            filesystemProvider.RootDirectory.RealPath.Should().Be("/level1/level2/");
        }