Skip to content

Commit e3e5524

Browse files
committed
Fix review issues
1 parent 76878f3 commit e3e5524

6 files changed

Lines changed: 9 additions & 17 deletions

File tree

Source/Mockolate/Interactions/MockInteractions.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TInteraction IMockInteractions.RegisterInteraction<TInteraction>(TInteraction in
3434
{
3535
_missingVerification?.Add(interaction);
3636
_interactions.TryAdd(interaction.Index, interaction);
37-
InteractionAdded?.Invoke(this, interaction);
37+
InteractionAdded?.Invoke(this, EventArgs.Empty);
3838
return interaction;
3939
}
4040

@@ -47,11 +47,7 @@ public IReadOnlyCollection<IInteraction> GetUnverifiedInteractions()
4747
return _missingVerification;
4848
}
4949

50-
/// <summary>
51-
/// Notifies whenever an interaction was registered on the mock.
52-
/// </summary>
53-
public event EventHandler<IInteraction>? InteractionAdded;
54-
50+
internal event EventHandler? InteractionAdded;
5551
internal event EventHandler? OnClearing;
5652

5753
internal int GetNextIndex()

Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ namespace Mockolate.Interactions
534534
public MockInteractions() { }
535535
public int Count { get; }
536536
public System.Collections.Generic.IEnumerable<Mockolate.Interactions.IInteraction> Interactions { get; }
537-
public event System.EventHandler<Mockolate.Interactions.IInteraction>? InteractionAdded;
538537
public System.Collections.Generic.IReadOnlyCollection<Mockolate.Interactions.IInteraction> GetUnverifiedInteractions() { }
539538
}
540539
[System.Diagnostics.DebuggerDisplay("{ToString()}")]

Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ namespace Mockolate.Interactions
533533
public MockInteractions() { }
534534
public int Count { get; }
535535
public System.Collections.Generic.IEnumerable<Mockolate.Interactions.IInteraction> Interactions { get; }
536-
public event System.EventHandler<Mockolate.Interactions.IInteraction>? InteractionAdded;
537536
public System.Collections.Generic.IReadOnlyCollection<Mockolate.Interactions.IInteraction> GetUnverifiedInteractions() { }
538537
}
539538
[System.Diagnostics.DebuggerDisplay("{ToString()}")]

Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ namespace Mockolate.Interactions
500500
public MockInteractions() { }
501501
public int Count { get; }
502502
public System.Collections.Generic.IEnumerable<Mockolate.Interactions.IInteraction> Interactions { get; }
503-
public event System.EventHandler<Mockolate.Interactions.IInteraction>? InteractionAdded;
504503
public System.Collections.Generic.IReadOnlyCollection<Mockolate.Interactions.IInteraction> GetUnverifiedInteractions() { }
505504
}
506505
[System.Diagnostics.DebuggerDisplay("{ToString()}")]

Tests/Mockolate.Tests/Interactions/MockInteractionsTests.cs renamed to Tests/Mockolate.Internal.Tests/MockInteractionsTests.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
using System.Collections.Generic;
21
using Mockolate.Interactions;
32

4-
namespace Mockolate.Tests.Interactions;
3+
namespace Mockolate.Internal.Tests;
54

65
public class MockInteractionsTests
76
{
87
[Fact]
98
public async Task InteractionAdded_ShouldIncludeInteraction()
109
{
11-
List<IInteraction> addedInteractions = [];
10+
int interactionCount = 0;
1211
MockInteractions sut = new();
1312
MethodInvocation interaction = new(0, "foo", []);
1413
sut.InteractionAdded += OnInteractionAdded;
@@ -17,11 +16,11 @@ public async Task InteractionAdded_ShouldIncludeInteraction()
1716

1817
sut.InteractionAdded -= OnInteractionAdded;
1918

20-
await That(addedInteractions).HasSingle().Which.IsSameAs(interaction);
19+
await That(interactionCount).IsEqualTo(1);
2120

22-
void OnInteractionAdded(object? sender, IInteraction e)
21+
void OnInteractionAdded(object? sender, EventArgs e)
2322
{
24-
addedInteractions.Add(e);
23+
interactionCount++;
2524
}
2625
}
2726

Tests/Mockolate.Tests/Verify/MockVerifyTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public async Task VerificationResult_ShouldUpdateWhenInteractionsChange()
276276

277277
await That(r0).IsTrue().Because("No interaction was performed yet");
278278
await That(r1).IsTrue().Because("One interaction was performed");
279-
await That(r2).IsTrue().Because("The second interactions did not match");
280-
await That(r3).IsTrue().Because("The third interactions did again match");
279+
await That(r2).IsTrue().Because("The second interaction did not match");
280+
await That(r3).IsTrue().Because("The third interaction did again match");
281281
}
282282
}

0 commit comments

Comments
 (0)