-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Corniel Nobel
committed
Jun 7, 2023
1 parent
a656480
commit 50371d6
Showing
6 changed files
with
20 additions
and
32 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
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
4 changes: 1 addition & 3 deletions
4
test/Qowaiv.DomainModel.UnitTests/Models/SimpleEventSourcedAggregate.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
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
35 changes: 16 additions & 19 deletions
35
test/Qowaiv.DomainModel.UnitTests/TestTools/QowaivAssemblyAssertions.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 |
---|---|---|
@@ -1,30 +1,27 @@ | ||
using FluentAssertions.Execution; | ||
using FluentAssertions.Reflection; | ||
using Qowaiv; | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace FluentAssertions | ||
namespace FluentAssertions; | ||
|
||
/// <summary>Extensions on <see cref="AssemblyAssertions"/>.</summary> | ||
internal static class QowaivAssemblyAssertions | ||
{ | ||
/// <summary>Extensions on <see cref="AssemblyAssertions"/>.</summary> | ||
public static class QowaivAssemblyAssertions | ||
/// <summary>Asserts the <see cref="Assembly"/> to have a specific public key.</summary> | ||
public static AndConstraint<AssemblyAssertions> HavePublicKey(this AssemblyAssertions assertions, string publicKey, string because = "", params object[] becauseArgs) | ||
{ | ||
/// <summary>Asserts the <see cref="Assembly"/> to have a specific public key.</summary> | ||
public static AndConstraint<AssemblyAssertions> HavePublicKey(this AssemblyAssertions assertions, string publicKey, string because = "", params object[] becauseArgs) | ||
{ | ||
Guard.NotNull(assertions, nameof(assertions)); | ||
Guard.NotNull(assertions, nameof(assertions)); | ||
|
||
var bytes = assertions.Subject.GetName().GetPublicKey() ?? Array.Empty<byte>(); | ||
var assemblyKey = BitConverter.ToString(bytes).Replace("-", ""); | ||
var bytes = assertions.Subject.GetName().GetPublicKey() ?? Array.Empty<byte>(); | ||
var assemblyKey = BitConverter.ToString(bytes).Replace("-", ""); | ||
|
||
Execute.Assertion | ||
.BecauseOf(because, becauseArgs) | ||
.ForCondition(assemblyKey == publicKey) | ||
.FailWith( | ||
$"Expected '{assertions.Subject}' to have public key: {publicKey},{Environment.NewLine}" + | ||
$"but got: {assemblyKey} instead."); | ||
Execute.Assertion | ||
.BecauseOf(because, becauseArgs) | ||
.ForCondition(assemblyKey == publicKey) | ||
.FailWith( | ||
$"Expected '{assertions.Subject}' to have public key: {publicKey},{Environment.NewLine}" + | ||
$"but got: {assemblyKey} instead."); | ||
|
||
return new AndConstraint<AssemblyAssertions>(assertions); | ||
} | ||
return new AndConstraint<AssemblyAssertions>(assertions); | ||
} | ||
} |