Skip to content

Commit 796d767

Browse files
committed
fix runtime version issues
1 parent 0be0a0e commit 796d767

7 files changed

Lines changed: 81 additions & 75 deletions

File tree

.github/workflows/Build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: FileSystem [Build]
33
env:
44
JAVA_VERSION: 11
55
JAVA_DISTRIBUTION: microsoft
6-
DOTNET_VERSION: 6.0.x
6+
DOTNET_VERSION: 7.0.x
77
DOTNET_BUILD_CONFIGURATION: Release
88
SONAR_PATH: .\.sonar\scanner
99
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Tests/Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
56
<LangVersion>latest</LangVersion>
67
<IsPackable>false</IsPackable>
78
</PropertyGroup>

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

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,49 @@
88
using SharpGrip.FileSystem.Models;
99
using Xunit;
1010

11-
namespace Tests.FileSystem.Adapters.AmazonS3;
12-
13-
public class AmazonS3AdapterTest
11+
namespace Tests.FileSystem.Adapters.AmazonS3
1412
{
15-
[Fact]
16-
public void Test_Instantiation()
13+
public class AmazonS3AdapterTest
1714
{
18-
var amazonS3Client = new Mock<AmazonS3Client>("awsAccessKeyId", "awsSecretAccessKey", RegionEndpoint.USEast2);
19-
var amazonS3Adapter = new AmazonS3Adapter("prefix", "/root-path", amazonS3Client.Object, "bucket");
15+
[Fact]
16+
public void Test_Instantiation()
17+
{
18+
var amazonS3Client = new Mock<AmazonS3Client>("awsAccessKeyId", "awsSecretAccessKey", RegionEndpoint.USEast2);
19+
var amazonS3Adapter = new AmazonS3Adapter("prefix", "/root-path", amazonS3Client.Object, "bucket");
2020

21-
Assert.Equal("prefix", amazonS3Adapter.Prefix);
22-
Assert.Equal("/root-path", amazonS3Adapter.RootPath);
23-
}
21+
Assert.Equal("prefix", amazonS3Adapter.Prefix);
22+
Assert.Equal("/root-path", amazonS3Adapter.RootPath);
23+
}
2424

25-
[Fact]
26-
public async Task Test_Get_File_Async()
27-
{
28-
var amazonS3Client = new Mock<AmazonS3Client>("awsAccessKeyId", "awsSecretAccessKey", RegionEndpoint.USEast2);
29-
var amazonS3Adapter = new AmazonS3Adapter("prefix-1", "/root-path-1", amazonS3Client.Object, "bucket-1");
25+
[Fact]
26+
public async Task Test_Get_File_Async()
27+
{
28+
var amazonS3Client = new Mock<AmazonS3Client>("awsAccessKeyId", "awsSecretAccessKey", RegionEndpoint.USEast2);
29+
var amazonS3Adapter = new AmazonS3Adapter("prefix-1", "/root-path-1", amazonS3Client.Object, "bucket-1");
3030

31-
var getObjectResponse = new Mock<GetObjectResponse>();
31+
var getObjectResponse = new Mock<GetObjectResponse>();
3232

33-
getObjectResponse.SetupAllProperties();
34-
getObjectResponse.Object.Key = "test.txt";
35-
getObjectResponse.Object.ContentLength = 1;
36-
getObjectResponse.Object.LastModified = new DateTime(1970, 1, 1);
33+
getObjectResponse.SetupAllProperties();
34+
getObjectResponse.Object.Key = "test.txt";
35+
getObjectResponse.Object.ContentLength = 1;
36+
getObjectResponse.Object.LastModified = new DateTime(1970, 1, 1);
3737

38-
amazonS3Client.Setup(o => o.GetObjectAsync("bucket-1", "/root-path-1\\test.txt", default)).ReturnsAsync(getObjectResponse.Object);
38+
amazonS3Client.Setup(o => o.GetObjectAsync("bucket-1", "/root-path-1\\test.txt", default)).ReturnsAsync(getObjectResponse.Object);
3939

40-
var fileModel = new FileModel
41-
{
42-
Name = "test.txt",
43-
Path = "test.txt",
44-
Length = 1,
45-
LastModifiedDateTime = new DateTime(1970, 1, 1)
46-
};
47-
48-
var result = await amazonS3Adapter.GetFileAsync("test.txt");
49-
50-
Assert.Equal(fileModel.Name, result.Name);
51-
Assert.Equal(fileModel.Path, result.Path);
52-
Assert.Equal(fileModel.Length, result.Length);
53-
Assert.Equal(fileModel.LastModifiedDateTime, result.LastModifiedDateTime);
40+
var fileModel = new FileModel
41+
{
42+
Name = "test.txt",
43+
Path = "test.txt",
44+
Length = 1,
45+
LastModifiedDateTime = new DateTime(1970, 1, 1)
46+
};
47+
48+
var result = await amazonS3Adapter.GetFileAsync("test.txt");
49+
50+
Assert.Equal(fileModel.Name, result.Name);
51+
Assert.Equal(fileModel.Path, result.Path);
52+
Assert.Equal(fileModel.Length, result.Length);
53+
Assert.Equal(fileModel.LastModifiedDateTime, result.LastModifiedDateTime);
54+
}
5455
}
5556
}

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
using SharpGrip.FileSystem.Adapters.AzureBlobStorage;
44
using Xunit;
55

6-
namespace Tests.FileSystem.Adapters.AzureBlobStorage;
7-
8-
public class AzureBlobStorageAdapterTest
6+
namespace Tests.FileSystem.Adapters.AzureBlobStorage
97
{
10-
[Fact]
11-
public void Test_Instantiation()
8+
public class AzureBlobStorageAdapterTest
129
{
13-
var blobContainerClient = new Mock<BlobContainerClient>();
14-
var azureBlobStorageAdapter = new AzureBlobStorageAdapter("prefix", "/root-path", blobContainerClient.Object);
10+
[Fact]
11+
public void Test_Instantiation()
12+
{
13+
var blobContainerClient = new Mock<BlobContainerClient>();
14+
var azureBlobStorageAdapter = new AzureBlobStorageAdapter("prefix", "/root-path", blobContainerClient.Object);
1515

16-
Assert.Equal("prefix", azureBlobStorageAdapter.Prefix);
17-
Assert.Equal("/root-path", azureBlobStorageAdapter.RootPath);
16+
Assert.Equal("prefix", azureBlobStorageAdapter.Prefix);
17+
Assert.Equal("/root-path", azureBlobStorageAdapter.RootPath);
18+
}
1819
}
1920
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
namespace Tests.FileSystem.Adapters.AzureFileStorage;
2-
3-
public class AzureFileStorageAdapterTest
1+
namespace Tests.FileSystem.Adapters.AzureFileStorage
42
{
3+
public class AzureFileStorageAdapterTest
4+
{
5+
}
56
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
namespace Tests.FileSystem.Adapters.Dropbox;
2-
3-
public class DropboxAdapterTest
1+
namespace Tests.FileSystem.Adapters.Dropbox
42
{
3+
public class DropboxAdapterTest
4+
{
5+
}
56
}

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,36 @@
55
using SharpGrip.FileSystem.Exceptions;
66
using Xunit;
77

8-
namespace Tests.FileSystem.Adapters.Sftp;
9-
10-
public class SftpAdapterTest
8+
namespace Tests.FileSystem.Adapters.Sftp
119
{
12-
[Fact]
13-
public void Test_Instantiation()
10+
public class SftpAdapterTest
1411
{
15-
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
16-
var sftpAdapter = new SftpAdapter("prefix", "/root-path", sftpClient.Object);
12+
[Fact]
13+
public void Test_Instantiation()
14+
{
15+
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
16+
var sftpAdapter = new SftpAdapter("prefix", "/root-path", sftpClient.Object);
1717

18-
Assert.Equal("prefix", sftpAdapter.Prefix);
19-
Assert.Equal("/root-path", sftpAdapter.RootPath);
20-
}
18+
Assert.Equal("prefix", sftpAdapter.Prefix);
19+
Assert.Equal("/root-path", sftpAdapter.RootPath);
20+
}
2121

22-
[Fact]
23-
public void Test_Connect()
24-
{
25-
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
26-
var sftpAdapter = new SftpAdapter("prefix-1", "/root-path-1", sftpClient.Object);
22+
[Fact]
23+
public void Test_Connect()
24+
{
25+
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
26+
var sftpAdapter = new SftpAdapter("prefix-1", "/root-path-1", sftpClient.Object);
2727

28-
Assert.Throws<ConnectionException>(() => sftpAdapter.Connect());
29-
}
28+
Assert.Throws<ConnectionException>(() => sftpAdapter.Connect());
29+
}
3030

31-
[Fact]
32-
public async Task Test_Get_File_Async()
33-
{
34-
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
35-
var sftpAdapter = new SftpAdapter("prefix-1", "/root-path-1", sftpClient.Object);
31+
[Fact]
32+
public async Task Test_Get_File_Async()
33+
{
34+
var sftpClient = new Mock<SftpClient>("hostName", "userName", "password");
35+
var sftpAdapter = new SftpAdapter("prefix-1", "/root-path-1", sftpClient.Object);
3636

37-
await Assert.ThrowsAsync<ConnectionException>(async () => await sftpAdapter.GetFileAsync("test.txt"));
37+
await Assert.ThrowsAsync<ConnectionException>(async () => await sftpAdapter.GetFileAsync("test.txt"));
38+
}
3839
}
3940
}

0 commit comments

Comments
 (0)