Skip to content

Commit

Permalink
Boy-scout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel Nobel committed Jun 7, 2023
1 parent a656480 commit 50371d6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dotnet_diagnostic.SA1307.severity = none # Fields should begin with upper-case c
dotnet_diagnostic.SA1308.severity = none # Fields should begin with 'm_' prefix.
dotnet_diagnostic.SA1309.severity = none # Fields should begin with underscore.
dotnet_diagnostic.SA1310.severity = none # Fields should not contain underscores.
dotnet_diagnostic.SA1302.severity = none # Interface names should start with an I.
dotnet_diagnostic.SA1311.severity = none # Static read-only fields should begin with upper-case character.
dotnet_diagnostic.SA1503.severity = none # Braces should not be omitted.
dotnet_diagnostic.SA1513.severity = none # Closing brace should be followed by an empty line.
Expand Down
4 changes: 1 addition & 3 deletions specs/Benchmarks/Collections/Creation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Linq;

namespace Benchmarks.Collections;
namespace Benchmarks.Collections;

[MemoryDiagnoser]
public class Creation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Throws_when
[Test]
public void hander_could_not_be_resolved()
{
Action send = () => new InvalidReturnTypeProcessor(null).Send(new EmptyCommand());
Action send = () => new InvalidReturnTypeProcessor(null!).Send(new EmptyCommand());
send.Should().Throw<UnresolvedCommandHandler>().WithMessage(
"The command handler Commands.CommandProcessor_specs.SyncCommandHandler`1[Commands.CommandProcessor_specs.EmptyCommand] could not be resolved.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Models.Events;

namespace Qowaiv.DomainModel.UnitTests.Models;
namespace Qowaiv.DomainModel.UnitTests.Models;

public sealed class SimpleEventSourcedAggregate : Aggregate<SimpleEventSourcedAggregate, Guid>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ public void Ignores_null_event()
.Should().NotThrow();
}


internal class WhenWithDummyEvent
{
internal void When(DummyEvent _) => throw new Detected();
}

internal class WhenWithMultipleParameters
{
internal void When(DummyEvent @event, int other) => throw new NotSupportedException($"{@event} + {other}.");
Expand Down
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);
}
}

0 comments on commit 50371d6

Please sign in to comment.