diff --git a/Src/FluentAssertions/EventRaisingExtensions.cs b/Src/FluentAssertions/EventRaisingExtensions.cs index 61bff30c47..43e1b2afbc 100644 --- a/Src/FluentAssertions/EventRaisingExtensions.cs +++ b/Src/FluentAssertions/EventRaisingExtensions.cs @@ -14,9 +14,11 @@ namespace FluentAssertions public static class EventRaisingExtensions { /// - /// Asserts that all occurrences of the event originated from the and - /// returns only the events that came from that sender. + /// Asserts that all occurrences of the event originates from the . /// + /// + /// Returns only the events that comes from that sender. + /// public static IEventRecording WithSender(this IEventRecording eventRecording, object expectedSender) { var eventsForSender = new List(); @@ -53,10 +55,12 @@ public static IEventRecording WithSender(this IEventRecording eventRecording, ob } /// - /// Asserts that at least one occurence of the events had one or more arguments of the expected - /// type which matched the given predicate. - /// Returns only the events that matched both type and optionally a predicate. + /// Asserts that at least one occurrence of the events has some argument of the expected + /// type that matches the given predicate. /// + /// + /// Returns only the events having some argument matching both type and predicate. + /// public static IEventRecording WithArgs(this IEventRecording eventRecording, Expression> predicate) { Guard.ThrowIfArgumentIsNull(predicate, nameof(predicate)); @@ -79,7 +83,7 @@ public static IEventRecording WithArgs(this IEventRecording eventRecording, E Execute.Assertion .ForCondition(foundMatchingEvent) - .FailWith("Expected at least one event which arguments are of type <{0}> and matches {1}, but found none.", + .FailWith("Expected at least one event with some argument of type <{0}> that matches {1}, but found none.", typeof(T), predicate.Body); @@ -87,10 +91,12 @@ public static IEventRecording WithArgs(this IEventRecording eventRecording, E } /// - /// Asserts that at least one occurence of the events had one or more arguments of the expected - /// type which matched the predicates in the same order. - /// Returns only the events that matched both type and optionally predicates. + /// Asserts that at least one occurrence of the events has arguments of the expected + /// type that pairwise match all the given predicates. /// + /// + /// Returns only the events having arguments matching both type and all predicates. + /// /// /// If a null is provided as predicate argument, the corresponding event parameter value is ignored. /// @@ -128,7 +134,7 @@ public static IEventRecording WithArgs(this IEventRecording eventRecording, p if (!foundMatchingEvent) { Execute.Assertion - .FailWith("Expected at least one event which arguments are of type <{0}> and matches {1}, but found none.", + .FailWith("Expected at least one event with some arguments of type <{0}> that pairwise match {1}, but found none.", typeof(T), string.Join(" | ", predicates.Where(p => p is not null).Select(p => p.Body.ToString()))); } diff --git a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs index b5dc222de4..ba93158b67 100644 --- a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs @@ -179,7 +179,7 @@ public void When_the_event_parameters_dont_match_it_should_throw() act .Should().Throw() .WithMessage( - "Expected at least one event which arguments are of type*PropertyChangedEventArgs*matches*(args.PropertyName == \"SomeProperty\"), but found none."); + "Expected at least one event with some argument of type*PropertyChangedEventArgs*matches*(args.PropertyName == \"SomeProperty\"), but found none."); } [Fact] @@ -321,7 +321,7 @@ public void When_a_non_conventional_event_with_a_specific_argument_was_not_raise // Assert act.Should().Throw().WithMessage( - "Expected at least one event which arguments*type*Int32*matches*(args == " + wrongArgument + "), but found none."); + "Expected at least one event with some argument*type*Int32*matches*(args == " + wrongArgument + "), but found none."); } [Fact] @@ -340,7 +340,7 @@ public void When_a_non_conventional_event_with_many_specific_arguments_was_not_r // Assert act.Should().Throw().WithMessage( - "Expected at least one event which arguments*matches*\"(args == \"" + wrongArgument + + "Expected at least one event with some arguments*match*\"(args == \"" + wrongArgument + "\")\", but found none."); }