File tree Expand file tree Collapse file tree
Source/Mockolate/Interactions
Mockolate.Api.Tests/Expected Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( )
Original file line number Diff line number Diff 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()}")]
Original file line number Diff line number Diff 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()}")]
Original file line number Diff line number Diff 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()}")]
Original file line number Diff line number Diff line change 1- using System . Collections . Generic ;
21using Mockolate . Interactions ;
32
4- namespace Mockolate . Tests . Interactions ;
3+ namespace Mockolate . Internal . Tests ;
54
65public 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
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments