feat(secrets): abstractions value types, enums, exceptions
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using ZB.MOM.WW.Secrets.Abstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace ZB.MOM.WW.Secrets.Tests;
|
||||
|
||||
public class SecretNameTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("sql/historiangw/historian-password", "sql/historiangw/historian-password")]
|
||||
[InlineData(" SQL/Foo ", "sql/foo")] // trimmed + lowercased
|
||||
public void Normalizes(string input, string expected)
|
||||
=> Assert.Equal(expected, new SecretName(input).Value);
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
[InlineData("bad name with spaces")]
|
||||
[InlineData("../escape")]
|
||||
public void RejectsInvalid(string input)
|
||||
=> Assert.Throws<ArgumentException>(() => new SecretName(input));
|
||||
}
|
||||
Reference in New Issue
Block a user