-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SAMKeyEntryComparer and add related unit test
Fix new Codacy warnings
- Loading branch information
Showing
9 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
KeyManager.Library.KeyStore.NXP_SAM.Tests/KeyManager.Library.KeyStore.NXP_SAM.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
|
||
<RootNamespace>Leosac.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\KeyManager.Library.KeyStore.NXP_SAM\KeyManager.Library.KeyStore.NXP_SAM.csproj" /> | ||
<ProjectReference Include="..\KeyManager.Library\KeyManager.Library.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
28 changes: 28 additions & 0 deletions
28
KeyManager.Library.KeyStore.NXP_SAM.Tests/SAMKeyEntryComparerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Leosac.KeyManager.Library.KeyStore.NXP_SAM.Tests | ||
{ | ||
[TestClass] | ||
public class SAMKeyEntryComparerTests | ||
{ | ||
[TestMethod] | ||
public void Test_ListOrder() | ||
{ | ||
var comparer = new SAMKeyEntryComparer(new SAMKeyStoreProperties | ||
{ | ||
AuthenticateKeyEntryIdentifier = 0, | ||
AuthenticateKeyVersion = 0 | ||
}); | ||
|
||
var list = new List<SAMSymmetricKeyEntry>(new[] | ||
{ | ||
new SAMSymmetricKeyEntry { Identifier = new KeyEntryId("0") }, | ||
new SAMSymmetricKeyEntry { Identifier = new KeyEntryId("1") }, | ||
new SAMSymmetricKeyEntry { Identifier = new KeyEntryId("2") } | ||
}); | ||
var orderedList = list.Order(comparer); | ||
|
||
Assert.AreEqual("1", orderedList.ElementAt(0).Identifier.Id); | ||
Assert.AreEqual("2", orderedList.ElementAt(1).Identifier.Id); | ||
Assert.AreEqual("0", orderedList.ElementAt(2).Identifier.Id); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Microsoft.VisualStudio.TestTools.UnitTesting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters