Skip to content

Commit

Permalink
prep net 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMcKee committed Feb 7, 2024
1 parent 9dd05bf commit 941aa87
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 56 deletions.
3 changes: 2 additions & 1 deletion AspNet.DataProtection.Aws.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/TagSpaceBeforeHeaderEnd1/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlDocFormatter/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseVarWhenEvident</s:String>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright(c) $CURRENT_YEAR$ Jeff Hotchkiss&#xD;
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright(c) ${CurrentDate.Year} Jeff Hotchkiss&#xD;
Licensed under the MIT License. See License.md in the project root for license information.</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/PsiConfigurationSettingsKey/CustomLocation/@EntryValue">C:\Users\Jeff\AppData\Local\JetBrains\Transient\ReSharperPlatformVs15\v08_15eb0f4d\SolutionCaches</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ created as a custom context with key of `KmsConstants.ApplicationEncryptionConte

Prerequisites for building & testing:

- NET SDK 6+
- NET SDK 8+

Integration tests require AWS access, or modifying to access your own copy of AWS resources.
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "feature",
"version": "7.0.203"
"allowPrerelease": true
}
}
4 changes: 2 additions & 2 deletions integrate/IntegrationTests/CombinedManagerIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task ExpectFullKeyManagerExplicitAwsStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -103,7 +103,7 @@ public async Task ExpectFullKeyManagerStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down
16 changes: 8 additions & 8 deletions integrate/IntegrationTests/IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<Authors>chris mckee, hotchkj</Authors>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net48;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net48;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net8.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsPackable>false</IsPackable>
<!-- Disable analyzer warning since AWS SDK has incorrect versioning behaviour -->
Expand Down Expand Up @@ -37,15 +37,15 @@
<ProjectReference Include="..\..\src\AspNet.DataProtection.Aws.S3\AspNet.DataProtection.Aws.S3.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.*" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="Moq" Version="4.18.*" />
<PackageReference Include="Moq" Version="4.20.*" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="1.0.2" />
<PackageReference Include="xunit" Version="2.4.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.*">
<PackageReference Include="xunit" Version="2.6.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion integrate/IntegrationTests/KmsIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task ExpectDifferentContextsToFail()

dpOptions.ApplicationDiscriminator = "wrong";

var result = decryptor.DecryptAsync(encrypted.EncryptedElement, CancellationToken.None).Result;
var result = await decryptor.DecryptAsync(encrypted.EncryptedElement, CancellationToken.None);

await Assert.ThrowsAsync<InvalidCiphertextException>(
async () => await decryptor.DecryptAsync(encrypted.EncryptedElement, CancellationToken.None));
Expand Down
8 changes: 4 additions & 4 deletions integrate/IntegrationTests/KmsManagerIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void ExpectFullKeyManagerExplicitAwsStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -87,7 +87,7 @@ public void ExpectFullKeyManagerExplicitAwsStoreRetrieveWithConfigToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -115,7 +115,7 @@ public void ExpectFullKeyManagerStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -146,7 +146,7 @@ public void ExpectFullKeyManagerStoreRetrieveWithConfigToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down
22 changes: 11 additions & 11 deletions integrate/IntegrationTests/S3IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public async Task ExpectDefaultStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -92,7 +92,7 @@ public async Task ExpectNullCustomerMethodStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -110,7 +110,7 @@ public async Task ExpectNullServerSideMethodStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -128,7 +128,7 @@ public async Task ExpectCompressedStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -154,7 +154,7 @@ public async Task ExpectStorageClassStoreRetrieveToSucceed(S3StorageClass storag

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -174,7 +174,7 @@ public async Task ExpectCompatibilityToCompressedStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -194,7 +194,7 @@ public async Task ExpectCompatibilityFromCompressedStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -213,7 +213,7 @@ public async Task ExpectKmsStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -232,7 +232,7 @@ public async Task ExpectCustomStoreRetrieveToSucceed()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(1, list.Count);
Assert.Single(list);
Assert.True(XNode.DeepEquals(myXml, list.First()));
}

Expand All @@ -243,7 +243,7 @@ public async Task ExpectNonExistentQueryToSucceedWithZero()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(0, list.Count);
Assert.Empty(list);
}

[Fact]
Expand All @@ -253,7 +253,7 @@ public async Task ExpectEmptyQueryToSucceedWithZero()

IReadOnlyCollection<XElement> list = await xmlRepo.GetAllElementsAsync(CancellationToken.None);

Assert.Equal(0, list.Count);
Assert.Empty(list);
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions integrate/IntegrationTests/S3ManagerIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task ExpectFullKeyManagerExplicitAwsStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task ExpectFullKeyManagerExplicitAwsStoreRetrieveWithConfigToSuccee

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -126,7 +126,7 @@ public async Task ExpectFullKeyManagerStoreRetrieveWithConfigToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down Expand Up @@ -154,7 +154,7 @@ public async Task ExpectFullKeyManagerStoreRetrieveToSucceed()

IReadOnlyCollection<IKey> keys = keyManager.GetAllKeys();

Assert.Equal(1, keys.Count);
Assert.Single(keys);
Assert.Equal(activationDate, keys.Single().ActivationDate);
Assert.Equal(expirationDate, keys.Single().ExpirationDate);
Assert.NotNull(keys.Single().Descriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

<ItemGroup>
<PackageReference Include="AWSSDK.KeyManagementService" Version="[3.7,)" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="[6.0,)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[6.0,)" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[8.0,)" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="[8.0,)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
Expand Down
2 changes: 1 addition & 1 deletion src/AspNet.DataProtection.Aws.Kms/KmsXmlDecryptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task<XElement> DecryptAsync(XElement encryptedElement, Cancellation
{
ValidateConfig();

logger?.LogDebug("Decrypting ciphertext DataProtection key using AWS key {0}", Config.KeyId);
logger?.LogDebug("Decrypting ciphertext DataProtection key using AWS key {KeyId}", Config.KeyId);

using(var memoryStream = new MemoryStream())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="[3.7,)" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="[6.0,)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[6.0,)" />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[8.0,)" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="[8.0,)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<DebugType>portable</DebugType>
<LangVersion>11</LangVersion>

<VersionPrefix>3.1.1</VersionPrefix>
<VersionPrefix>3.2.0</VersionPrefix>
<Authors>chris mckee,hotchkj</Authors>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<PackageProjectUrl>https://github.com/chrismckee/AspNet.DataProtection.Aws</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
12 changes: 6 additions & 6 deletions test/Tests/S3XmlRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public void ExpectEmptyQueryToSucceed()

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(0, list.Count);
Assert.Empty(list);
}

[Theory]
Expand Down Expand Up @@ -502,7 +502,7 @@ public void ExpectSingleQueryToSucceed(string etag, string md5Header, bool valid

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(1, list.Count);
Assert.Single(list);

Assert.True(XNode.DeepEquals(myXml, list.First()));
}
Expand Down Expand Up @@ -624,7 +624,7 @@ public void ExpectFolderIgnored()

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(0, list.Count);
Assert.Empty(list);
}
}

Expand Down Expand Up @@ -676,7 +676,7 @@ public void ExpectSingleUncompressedCompatibleQueryToSucceed()

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(1, list.Count);
Assert.Single(list);

Assert.True(XNode.DeepEquals(myXml, list.First()));
}
Expand Down Expand Up @@ -740,7 +740,7 @@ public void ExpectSingleCompressedCompatibleQueryToSucceed()

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(1, list.Count);
Assert.Single(list);

Assert.True(XNode.DeepEquals(myXml, list.First()));
}
Expand Down Expand Up @@ -801,7 +801,7 @@ public void ExpectCustomSingleQueryToSucceed()

IReadOnlyCollection<XElement> list = xmlRepository.GetAllElements();

Assert.Equal(1, list.Count);
Assert.Single(list);

Assert.True(XNode.DeepEquals(myXml, list.First()));
}
Expand Down
16 changes: 8 additions & 8 deletions test/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net48;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net48;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net6.0;net8.0</TargetFrameworks>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<IsPackable>false</IsPackable>
<!-- Disable analyzer warning since AWS SDK has incorrect versioning behaviour -->
Expand Down Expand Up @@ -34,14 +34,14 @@
<ProjectReference Include="..\..\src\AspNet.DataProtection.Aws.S3\AspNet.DataProtection.Aws.S3.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.*" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.*" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Include="Moq" Version="4.18.*" />
<PackageReference Include="xunit" Version="2.4.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.*">
<PackageReference Include="Moq" Version="4.20.*" />
<PackageReference Include="xunit" Version="2.6.*" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 941aa87

Please sign in to comment.