Skip to content

Commit c328543

Browse files
committed
implement other tests
1 parent 41c616d commit c328543

4 files changed

Lines changed: 39 additions & 13 deletions

File tree

Tests/src/FileSystem.Adapters.AzureBlobStorage/AzureBlobStorageAdapterTest.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Azure.Storage.Blobs;
1+
using System.Threading.Tasks;
2+
using Azure.Storage.Blobs;
23
using NSubstitute;
34
using SharpGrip.FileSystem.Adapters.AzureBlobStorage;
45
using Xunit;
@@ -16,5 +17,16 @@ public void Test_Instantiation()
1617
Assert.Equal("prefix", azureBlobStorageAdapter.Prefix);
1718
Assert.Equal("/root-path", azureBlobStorageAdapter.RootPath);
1819
}
20+
21+
[Fact]
22+
public Task Test_Connect()
23+
{
24+
var blobContainerClient = Substitute.For<BlobContainerClient>();
25+
var azureBlobStorageAdapter = new AzureBlobStorageAdapter("prefix", "/root-path", blobContainerClient);
26+
27+
azureBlobStorageAdapter.Connect();
28+
29+
return Task.CompletedTask;
30+
}
1931
}
2032
}

Tests/src/FileSystem.Adapters.AzureFileStorage/AzureFileStorageAdapterTest.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Azure.Storage.Files.Shares;
1+
using System.Threading.Tasks;
2+
using Azure.Storage.Files.Shares;
23
using NSubstitute;
34
using SharpGrip.FileSystem.Adapters.AzureFileStorage;
45
using Xunit;
@@ -16,5 +17,16 @@ public void Test_Instantiation()
1617
Assert.Equal("prefix", azureFileStorageAdapter.Prefix);
1718
Assert.Equal("/root-path", azureFileStorageAdapter.RootPath);
1819
}
20+
21+
[Fact]
22+
public Task Test_Connect()
23+
{
24+
var shareClient = Substitute.For<ShareClient>();
25+
var azureFileStorageAdapter = new AzureFileStorageAdapter("prefix", "/root-path", shareClient);
26+
27+
azureFileStorageAdapter.Connect();
28+
29+
return Task.CompletedTask;
30+
}
1931
}
2032
}

Tests/src/FileSystem.Adapters.MicrosoftOneDrive/MicrosoftOneDriveAdapterTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,17 @@ public void Test_Instantiation()
1919
Assert.Equal("prefix", microsoftOneDriveAdapter.Prefix);
2020
Assert.Equal("/root-path", microsoftOneDriveAdapter.RootPath);
2121
}
22+
23+
[Fact]
24+
public Task Test_Connect()
25+
{
26+
var delegateAuthenticationProvider = new DelegateAuthenticationProvider(message => Task.FromResult(message.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "12345")));
27+
var graphServiceClient = Substitute.For<GraphServiceClient>(delegateAuthenticationProvider, null);
28+
var microsoftOneDriveAdapter = new MicrosoftOneDriveAdapter("prefix", "/root-path", graphServiceClient, "driveId");
29+
30+
microsoftOneDriveAdapter.Connect();
31+
32+
return Task.CompletedTask;
33+
}
2234
}
2335
}

Tests/src/FileSystem.Adapters.Sftp/SftpAdapterTest.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Threading.Tasks;
2-
using NSubstitute;
1+
using NSubstitute;
32
using Renci.SshNet;
43
using SharpGrip.FileSystem.Adapters.Sftp;
54
using SharpGrip.FileSystem.Exceptions;
@@ -27,14 +26,5 @@ public void Test_Connect()
2726

2827
Assert.Throws<ConnectionException>(() => sftpAdapter.Connect());
2928
}
30-
31-
[Fact]
32-
public async Task Test_Get_File_Async()
33-
{
34-
var sftpClient = Substitute.For<SftpClient>("hostName", "userName", "password");
35-
var sftpAdapter = new SftpAdapter("prefix-1", "/root-path-1", sftpClient);
36-
37-
await Assert.ThrowsAsync<ConnectionException>(async () => await sftpAdapter.GetFileAsync("prefix-1://test.txt"));
38-
}
3929
}
4030
}

0 commit comments

Comments
 (0)