Skip to content

Commit

Permalink
build: bump up donet 8 (#145)
Browse files Browse the repository at this point in the history
Bump up:
- dotnet 8
- dependencies

Fix: 
- unit test warnings

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>

---------

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
  • Loading branch information
JeyJeyGao committed Dec 26, 2023
1 parent e3fce3d commit 3d8f4af
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Build .NET project
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
contents: read
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Check out code into the project directory
uses: actions/checkout@v3
- name: Run unit tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void Constructor_Invalid()
}

[Fact]
public void RunAsync_NoSecertsGetPermission()
public async void RunAsync_NoSecertsGetPermission()
{
// Arrange
var keyId = "https://testvault.vault.azure.net/keys/testkey/123";
Expand All @@ -192,11 +192,11 @@ public void RunAsync_NoSecertsGetPermission()

var generateSignatureCommand = new GenerateSignature(request, mockKeyVaultClient.Object);

Assert.Throws<PluginException>(() => generateSignatureCommand.RunAsync().GetAwaiter().GetResult());
await Assert.ThrowsAsync<PluginException>(async () => await generateSignatureCommand.RunAsync());
}

[Fact]
public void RunAsync_OtherRequestFailedException()
public async void RunAsync_OtherRequestFailedException()
{
// Arrange
var keyId = "https://testvault.vault.azure.net/keys/testkey/123";
Expand All @@ -219,11 +219,11 @@ public void RunAsync_OtherRequestFailedException()

var generateSignatureCommand = new GenerateSignature(request, mockKeyVaultClient.Object);

Assert.Throws<Azure.RequestFailedException>(() => generateSignatureCommand.RunAsync().GetAwaiter().GetResult());
await Assert.ThrowsAsync<Azure.RequestFailedException>(async () => await generateSignatureCommand.RunAsync());
}

[Fact]
public void RunAsync_SelfSignedWithCaCerts()
public async void RunAsync_SelfSignedWithCaCerts()
{
// Arrange
var keyId = "https://testvault.vault.azure.net/keys/testkey/123";
Expand All @@ -246,7 +246,7 @@ public void RunAsync_SelfSignedWithCaCerts()

var generateSignatureCommand = new GenerateSignature(request, mockKeyVaultClient.Object);

Assert.Throws<PluginException>(() => generateSignatureCommand.RunAsync().GetAwaiter().GetResult());
await Assert.ThrowsAsync<PluginException>(async () => await generateSignatureCommand.RunAsync());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void TestConstructorWithInvalidKeyId(string invalidKeyId)

[Theory]
[InlineData("")]
[InlineData(null)]
public void TestConstructorWithEmptyKeyId(string invalidKeyId)
{
Assert.Throws<ArgumentNullException>(() => new KeyVaultClient(invalidKeyId));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="Moq.AutoMock" Version="3.5.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ public void DescribeKeyRequest_ValidParameters()
}

[Theory]
[InlineData(null, "test-key-id")]
[InlineData("", "test-key-id")]
[InlineData("1.0", null)]
[InlineData("1.0", "")]
public void DescribeKeyRequest_InvalidParameters_ThrowsException(string contractVersion, string keyId)
{
Expand Down Expand Up @@ -60,9 +58,7 @@ public void DescribeKeyResponse_ValidParameters()
}

[Theory]
[InlineData(null, "RSA-2048")]
[InlineData("", "RSA-2048")]
[InlineData("test-key-id", null)]
[InlineData("test-key-id", "")]
public void DescribeKeyResponse_InvalidParameters_ThrowsException(string keyId, string keySpec)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Notation.Plugin.AzureKeyVault</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -16,11 +16,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.8.2" />
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.5.1" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="4.5.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.5.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="7.0.3" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.0" />
</ItemGroup>

<Target Name="GenerateBuildMetadata" BeforeTargets="CoreCompile">
Expand Down

0 comments on commit 3d8f4af

Please sign in to comment.