Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: .Should().PushAnySatisfying(..) #2

Open
jeffijoe opened this issue Jun 1, 2021 · 4 comments
Open

Request: .Should().PushAnySatisfying(..) #2

jeffijoe opened this issue Jun 1, 2021 · 4 comments

Comments

@jeffijoe
Copy link

jeffijoe commented Jun 1, 2021

Description

Just started using FA.Reactive and it's awesome, great work!

I have a suggestion for an assertion similar to SatisfyRespectively for collection assertions: PushAnySatisfying

Use Case

I am looking for an occurrence of a particular element that satisfies some constraints. I don't care about the ordering, hence the Any of PushAnySatisfying.

Example usage:

observable.Observe()
    .Should()
    .PushAnySatisfying(e => {
        e.Property.Should().Be("value");
        e.OtherProperty.Should().Be("other value");
    });
@rose-a
Copy link
Collaborator

rose-a commented Nov 1, 2021

Hey @jeffijoe, sorry for the long delay, this seems to have somehow slipped my attention...

Good suggestion, I'll take a look at it!

@jeffijoe
Copy link
Author

jeffijoe commented Nov 1, 2021

No worries at all, thank you for the response!

@rose-a
Copy link
Collaborator

rose-a commented Nov 2, 2021

I went with a slightly different syntax (using predicates, see #5) which is more in line with the collection assertions of the main library:

observable.Observe()
    .Should()
    .PushMatch(e => e.Property.Equals("value") && e.OtherProperty.Equals("other value"));

Hope this will satisfy your needs...

@jeffijoe
Copy link
Author

jeffijoe commented Nov 2, 2021

That makes sense, I noticed those as well much later after posting this. Thank you so much! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants