diff --git a/.csharpierignore b/.csharpierignore
new file mode 100644
index 0000000..457dbe4
--- /dev/null
+++ b/.csharpierignore
@@ -0,0 +1,2 @@
+# .csharpierignore
+!**/*.cs
\ No newline at end of file
diff --git a/EncryptedConfigValue.AspNetCore.Test/EncryptedConfigValue.AspNetCore.Test.csproj b/EncryptedConfigValue.AspNetCore.Test/EncryptedConfigValue.AspNetCore.Test.csproj
index 57920db..e481b51 100644
--- a/EncryptedConfigValue.AspNetCore.Test/EncryptedConfigValue.AspNetCore.Test.csproj
+++ b/EncryptedConfigValue.AspNetCore.Test/EncryptedConfigValue.AspNetCore.Test.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/EncryptedConfigValue.AspNetCore.Test/SubstitutingConfigurationFactoryTest.cs b/EncryptedConfigValue.AspNetCore.Test/SubstitutingConfigurationFactoryTest.cs
index 847f54e..51299b0 100644
--- a/EncryptedConfigValue.AspNetCore.Test/SubstitutingConfigurationFactoryTest.cs
+++ b/EncryptedConfigValue.AspNetCore.Test/SubstitutingConfigurationFactoryTest.cs
@@ -1,12 +1,13 @@
using EncryptedConfigValue.AspNetCore.Test.Util;
using EncryptedConfigValue.Crypto;
using EncryptedConfigValue.Crypto.Util;
-using FluentAssertions;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;
+using Shouldly;
+using System.Text.RegularExpressions;
namespace EncryptedConfigValue.AspNetCore.Test
{
@@ -25,25 +26,25 @@ public void TestDecryptionSucceeds()
.AddEncryptedConfigValueProvider()
.Build();
- configuration["Unencrypted"].Should().Be("value");
- configuration["Encrypted"].Should().Be("value");
- configuration["EncryptedWithSingleQuote"].Should().Be("don't use quotes");
- configuration["EncryptedWithDoubleQuote"].Should().Be("double quote is \"");
- configuration["EncryptedMalformedYaml"].Should().Be("[oh dear");
+ configuration["Unencrypted"].ShouldBe("value");
+ configuration["Encrypted"].ShouldBe("value");
+ configuration["EncryptedWithSingleQuote"].ShouldBe("don't use quotes");
+ configuration["EncryptedWithDoubleQuote"].ShouldBe("double quote is \"");
+ configuration["EncryptedMalformedYaml"].ShouldBe("[oh dear");
configuration
.GetSection("ArrayWithSomeEncryptedValues")
.GetChildren()
.Select(x => x.Value)
- .Should()
- .BeEquivalentTo(new List { "value", "value", "other value", "[oh dear" });
+ .ToList()
+ .ShouldBeEquivalentTo(new List { "value", "value", "other value", "[oh dear" });
var person = new Person();
configuration
.GetSection("PocoWithEncryptedValues")
.Bind(person);
- person.Username.Should().BeEquivalentTo("some-user");
- person.Password.Should().BeEquivalentTo("value");
+ person.Username.ShouldBeEquivalentTo("some-user");
+ person.Password.ShouldBeEquivalentTo("value");
}
[Fact]
@@ -53,11 +54,10 @@ public void TestDecryptionFailsWithNiceMessage()
.AddJsonFile(Path.Combine("Resources", "testConfigWithError.json"), optional: false, reloadOnChange: false)
.AddEncryptedConfigValueProvider()
.Build();
- act.Should()
- .Throw()
- .WithMessage($"Configuration decryption error at {Path.Combine("Resources", "testConfigWithError.json")} (*)")
- .WithInnerExceptionExactly()
- .WithMessage("The value 'enc:ERROR' for field 'arrayWithSomeEncryptedValues:3' could not be replaced");
+ var ex = Should.Throw(act);
+ ex.Message.ShouldMatch($@"Configuration decryption error at {Regex.Escape(Path.Combine("Resources", "testConfigWithError.json"))} \(.*\)");
+ ex.InnerException.ShouldBeOfType();
+ ex.InnerException.Message.ShouldBe("The value 'enc:ERROR' for field 'ArrayWithSomeEncryptedValues:3' could not be replaced");
}
}
}
diff --git a/EncryptedConfigValue.AspNetCore.Test/VariableSubstitutionTest.cs b/EncryptedConfigValue.AspNetCore.Test/VariableSubstitutionTest.cs
index fac60b9..c41333f 100644
--- a/EncryptedConfigValue.AspNetCore.Test/VariableSubstitutionTest.cs
+++ b/EncryptedConfigValue.AspNetCore.Test/VariableSubstitutionTest.cs
@@ -1,6 +1,6 @@
using EncryptedConfigValue.AspNetCore.Test.Util;
using EncryptedConfigValue.Crypto;
-using FluentAssertions;
+using Shouldly;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using System;
@@ -31,25 +31,25 @@ private static WebApplication CreateWebApplication()
[Fact]
public void TestCanDecryptValueInConfig()
{
- aspnet.Configuration["Unencrypted"].Should().Be("value");
- aspnet.Configuration["Encrypted"].Should().Be("value");
- aspnet.Configuration["EncryptedWithSingleQuote"].Should().Be("don't use quotes");
- aspnet.Configuration["EncryptedWithDoubleQuote"].Should().Be("double quote is \"");
- aspnet.Configuration["EncryptedMalformedYaml"].Should().Be("[oh dear");
+ aspnet.Configuration["Unencrypted"].ShouldBe("value");
+ aspnet.Configuration["Encrypted"].ShouldBe("value");
+ aspnet.Configuration["EncryptedWithSingleQuote"].ShouldBe("don't use quotes");
+ aspnet.Configuration["EncryptedWithDoubleQuote"].ShouldBe("double quote is \"");
+ aspnet.Configuration["EncryptedMalformedYaml"].ShouldBe("[oh dear");
aspnet.Configuration
.GetSection("ArrayWithSomeEncryptedValues")
.GetChildren()
.Select(x => x.Value)
- .Should()
- .BeEquivalentTo(new List { "value", "value", "other value", "[oh dear" });
+ .ToList()
+ .ShouldBeEquivalentTo(new List { "value", "value", "other value", "[oh dear" });
var person = new Person();
aspnet.Configuration
.GetSection("PocoWithEncryptedValues")
.Bind(person);
- person.Username.Should().BeEquivalentTo("some-user");
- person.Password.Should().BeEquivalentTo("value");
+ person.Username.ShouldBeEquivalentTo("some-user");
+ person.Password.ShouldBeEquivalentTo("value");
}
}
}
diff --git a/EncryptedConfigValue.Cli.Test/EncryptConfigValueCommandTest.cs b/EncryptedConfigValue.Cli.Test/EncryptConfigValueCommandTest.cs
index 7fab6d7..5622f55 100644
--- a/EncryptedConfigValue.Cli.Test/EncryptConfigValueCommandTest.cs
+++ b/EncryptedConfigValue.Cli.Test/EncryptConfigValueCommandTest.cs
@@ -1,6 +1,6 @@
using EncryptedConfigValue.Crypto;
using EncryptedConfigValue.Crypto.Algorithm;
-using FluentAssertions;
+using Shouldly;
using System;
using System.Collections.Generic;
using System.IO;
@@ -69,7 +69,7 @@ internal void WeEncryptAndPrintAValue(Algorithm algorithm)
var decryptionKey = keyPair.DecryptionKey;
var decryptedValue = configValue.Decrypt(decryptionKey);
- decryptedValue.Should().BeEquivalentTo(plaintext);
+ decryptedValue.ShouldBeEquivalentTo(plaintext);
}
[Fact]
@@ -100,7 +100,7 @@ internal void WeFailIfTheKeyfileDoesNotExist()
command.Execute("--keyfile", tempFilePath, "--value", plaintext);
};
- act.Should().Throw();
+ act.ShouldThrow();
}
public static IEnumerable
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/EncryptedConfigValue.Cli.Test/GenerateKeyCommandTest.cs b/EncryptedConfigValue.Cli.Test/GenerateKeyCommandTest.cs
index d6c821d..2752a52 100644
--- a/EncryptedConfigValue.Cli.Test/GenerateKeyCommandTest.cs
+++ b/EncryptedConfigValue.Cli.Test/GenerateKeyCommandTest.cs
@@ -1,6 +1,6 @@
using EncryptedConfigValue.Crypto;
using EncryptedConfigValue.Crypto.Algorithm;
-using FluentAssertions;
+using Shouldly;
using System;
using System.Collections.Generic;
using System.IO;
@@ -42,7 +42,7 @@ public void WeGenerateAValidKey(Algorithm algorithm)
command.Execute("--algorithm", algorithm.ToString(), "--file", tempFilePath);
var keyPair = KeyFileUtils.KeyPairFromPath(tempFilePath);
- keyPair.EncryptionKey.Type.Algorithm.Should().BeEquivalentTo(algorithm);
+ keyPair.EncryptionKey.Type.Algorithm.ShouldBeEquivalentTo(algorithm);
}
[Fact]
@@ -62,8 +62,8 @@ public void WeDoNotOverwriteAnExistingKeyfile()
{
command.Execute("--algorithm", algorithm.ToString(), "--file", tempFilePath);
};
-
- act.Should().Throw().WithMessage("*already exists*");
+ var ex = Should.Throw(act);
+ ex.Message.ShouldMatch("(.*)already exists*");
}
public static IEnumerable