Background and motivation
To ensure that the public key of an signed assembly does not accidentally changes, having an assertion .HavePublicKey(string) can help. For completeness/symmetry reasons adding .BeUnsigned() might be beneficial too.
API Proposal
public class AssemblyAssertions : ReferenceTypeAssertions<Assembly, AssemblyAssertions>
{
public AndConstraint<AssemblyAssertions> NotHavePublicKey(string because = "", params object[] becauseArgs);
public AndConstraint<AssemblyAssertions> HavePublicKey(string publicKey, string because = "", params object[] becauseArgs);
}
API Usage
var signed = typeof(AssemblyA.ClassA).Assembly;
signed.Should().HavePublicKey("sdfds");
var unsigned = typeof(AssemblyB.ClassB).Assembly;
unsigned.Should().NotHavePublicKey();
Alternative Designs
No response
Risks
No response