opened
RyanBuzzInteractive
username_0
I wanted to check the number of times RaisePropertyChanged had been raised for a particular property.

I expected to type:

`myVm.ShouldRaisePropertyChangedFor(vm => vm.myProperty).Count().ShouldBeEquivalentTo(2);`

This failed - the count returned was for ALL RaisePropertyChange events, not the specific one I am testing.

I have written a quick extension method:

` public static int SpecificRaisePropertyChangedCount(this IEnumerable<RecordedEvent> value, string propertyName)
        {
            return value.Select(r => r.Parameters)
                .SelectMany(s => s)
                .Count(p => p is PropertyChangedEventArgs && (p as PropertyChangedEventArgs).PropertyName == propertyName);
        }`

so you can now do:

`myVm.ShouldRaisePropertyChangedFor(vm => vm.myProperty).SpecificRaisePropertyChangedCount(nameof(myVm.myProperty)).ShouldBeEquivalentTo(2);`

Sorry I haven't submitted this as a pull request - I'm up to my neck in it and no time to clone the repo etc, but feel free to add it or whatever (or tell me that I could have done it with the existing code easily ^_^ )
ShouldRaisePropertyChangedFor followed by Count behaves unexpectedly (solution here)
issue
created
dennisdoomen
username_1
Thanks for reporting this. I'll take a look at it.
comment
created
BrunoJuchli
username_2
This is caused by https://github.com/fluentassertions/fluentassertions/issues/337
comment