Skip to content

Commit d6f49d3

Browse files
committed
improve sftp adapter unit tests
1 parent b4e48ab commit d6f49d3

File tree

10 files changed

+454
-26
lines changed

10 files changed

+454
-26
lines changed

FileSystem.Adapters.AmazonS3/FileSystem.Adapters.AmazonS3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="AWSSDK.S3" Version="3.7.201.2" />
20+
<PackageReference Include="AWSSDK.S3" Version="3.7.205.17" />
2121
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

FileSystem.Adapters.AzureBlobStorage/FileSystem.Adapters.AzureBlobStorage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Azure.Storage.Blobs" Version="12.17.0" />
20+
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
2121
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

FileSystem.Adapters.AzureFileStorage/FileSystem.Adapters.AzureFileStorage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.15.0" />
20+
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0" />
2121
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

FileSystem.Adapters.MicrosoftOneDrive/FileSystem.Adapters.MicrosoftOneDrive.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.Graph" Version="4.54.0" />
21-
<PackageReference Include="Microsoft.Identity.Client" Version="4.55.0" />
21+
<PackageReference Include="Microsoft.Identity.Client" Version="4.57.0" />
2222
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

FileSystem.Adapters.Sftp/FileSystem.Adapters.Sftp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
</PackageReference>
24-
<PackageReference Include="SSH.NET" Version="2020.0.2" />
24+
<PackageReference Include="SSH.NET" Version="2023.0.0" />
2525
</ItemGroup>
2626

2727
<ItemGroup>

FileSystem.Adapters.Sftp/src/ModelFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace SharpGrip.FileSystem.Adapters.Sftp
55
{
66
public static class ModelFactory
77
{
8-
public static IFile CreateFile(SftpFile file, string virtualPath)
8+
public static IFile CreateFile(ISftpFile file, string virtualPath)
99
{
1010
return new FileModel
1111
{
@@ -17,7 +17,7 @@ public static IFile CreateFile(SftpFile file, string virtualPath)
1717
};
1818
}
1919

20-
public static DirectoryModel CreateDirectory(SftpFile directory, string virtualPath)
20+
public static DirectoryModel CreateDirectory(ISftpFile directory, string virtualPath)
2121
{
2222
return new DirectoryModel
2323
{

FileSystem.Adapters.Sftp/src/SftpAdapter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ namespace SharpGrip.FileSystem.Adapters.Sftp
1818
{
1919
public class SftpAdapter : Adapter<SftpAdapterConfiguration, string, string>
2020
{
21-
private readonly SftpClient client;
21+
private readonly ISftpClient client;
2222

23-
public SftpAdapter(string prefix, string rootPath, SftpClient client, Action<SftpAdapterConfiguration>? configuration = null) : base(prefix, rootPath, configuration)
23+
public SftpAdapter(string prefix, string rootPath, ISftpClient client, Action<SftpAdapterConfiguration>? configuration = null) : base(prefix, rootPath, configuration)
2424
{
2525
this.client = client;
2626
}
2727

2828
public override void Dispose()
2929
{
30-
client.Dispose();
30+
((IBaseClient) client).Dispose();
3131
}
3232

3333
public override void Connect()

Tests/Tests.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
12-
<PackageReference Include="NSubstitute" Version="5.0.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
12+
<PackageReference Include="NSubstitute" Version="5.1.0" />
1313
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>
17-
<PackageReference Include="xunit" Version="2.5.0" />
18-
<PackageReference Include="xunit.runner.console" Version="2.5.0">
17+
<PackageReference Include="xunit" Version="2.5.3" />
18+
<PackageReference Include="xunit.runner.console" Version="2.5.3">
1919
<PrivateAssets>all</PrivateAssets>
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
</PackageReference>
22-
<PackageReference Include="xunit.runner.msbuild" Version="2.5.0">
22+
<PackageReference Include="xunit.runner.msbuild" Version="2.5.3">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>
26-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
26+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
2727
<PrivateAssets>all</PrivateAssets>
2828
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2929
</PackageReference>

Tests/src/FileSystem.Adapters.AmazonS3/AmazonS3AdapterTest.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,8 @@ public async Task Test_File_Exists_Async()
237237
Assert.True(await fileSystem.FileExistsAsync("prefix-1://test1.txt"));
238238
Assert.False(await fileSystem.FileExistsAsync("prefix-1://test2.txt"));
239239

240-
await Assert.ThrowsAsync<FileNotFoundException>(() => fileSystem.GetFileAsync("prefix-1://test2.txt"));
241-
await Assert.ThrowsAsync<ConnectionException>(() => fileSystem.GetFileAsync("prefix-1://test3.txt"));
242-
await Assert.ThrowsAsync<ConnectionException>(() => fileSystem.GetFileAsync("prefix-1://test4.txt"));
240+
await Assert.ThrowsAsync<ConnectionException>(() => fileSystem.FileExistsAsync("prefix-1://test3.txt"));
241+
await Assert.ThrowsAsync<ConnectionException>(() => fileSystem.FileExistsAsync("prefix-1://test4.txt"));
243242
}
244243

245244
[Fact]

0 commit comments

Comments
 (0)