Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 6, 2024
1 parent 4a5ada4 commit 7e3e758
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `NuGetKeyVaultSignTool` for nuke version `8.*`.
- Add `AzureKeyVaultConfig` with json file with `Azure Key Vault` without secrets.
- Add `build` with `.targets` to install packages `AzureSignTool` and `NuGetKeyVaultSignTool`.
### Tests
- Update `NuGetExtensionTests`
- Add `AzureKeyVaultConfigTests`

## [1.8.2] / 2024-11-20
### Updates
Expand Down
56 changes: 56 additions & 0 deletions ricaun.Nuke.Tests/AzureKeyVaultConfigTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using NUnit.Framework;
using ricaun.Nuke.Tools;

namespace Nuke.NuGetKeyVaultSignTool
{
public class AzureKeyVaultConfigTests
{
[Test]
public void JsonIsNotValidTest()
{
var content = """
{
"AzureKeyVaultCertificate": "",
"AzureKeyVaultUrl": "",
"AzureKeyVaultClientId": "",
"AzureKeyVaultTenantId": ""
}
""";

var azureKeyVaultFile = AzureKeyVaultConfig.Create(content);
Assert.IsNotNull(azureKeyVaultFile);
Assert.IsFalse(azureKeyVaultFile.IsValid());
}

[Test]
public void JsonIsNullTest()
{
var content = "";

var azureKeyVaultFile = AzureKeyVaultConfig.Create(content);
Assert.IsNull(azureKeyVaultFile);
}

[Test]
public void JsonIsValidTest()
{
var content = """
{
"AzureKeyVaultCertificate": "AzureKeyVaultCertificate",
"AzureKeyVaultUrl": "AzureKeyVaultUrl",
"AzureKeyVaultClientId": "AzureKeyVaultClientId",
"AzureKeyVaultTenantId": "AzureKeyVaultTenantId"
}
""";

var azureKeyVaultFile = AzureKeyVaultConfig.Create(content);
Assert.IsNotNull(azureKeyVaultFile);
Assert.IsTrue(azureKeyVaultFile.IsValid());
Assert.AreEqual("AzureKeyVaultCertificate", azureKeyVaultFile.AzureKeyVaultCertificate);
Assert.AreEqual("AzureKeyVaultUrl", azureKeyVaultFile.AzureKeyVaultUrl);
Assert.AreEqual("AzureKeyVaultClientId", azureKeyVaultFile.AzureKeyVaultClientId);
Assert.AreEqual("AzureKeyVaultTenantId", azureKeyVaultFile.AzureKeyVaultTenantId);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace ricaun.Nuke.Tests
{
#if NET
public class TestsNet
public class NuGetExtensionTests
{
[Test]
public void Test1()
public void Test_PackageNameAndVersion()
{
var packages = new[] {
"ricaun.example.1.2.3.nupkg",
Expand All @@ -26,5 +25,4 @@ public void Test1()
}
}
}
#endif
}
4 changes: 2 additions & 2 deletions ricaun.Nuke.Tests/ricaun.Nuke.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6;net45</TargetFrameworks>
<TargetFrameworks>net6</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == net6">
<ItemGroup>
<ProjectReference Include="..\ricaun.Nuke\ricaun.Nuke.csproj" />
</ItemGroup>

Expand Down

0 comments on commit 7e3e758

Please sign in to comment.