Skip to content

Is there an ability to reuse the EqualTo methods on your own built extension? #1724

Answered by thomhurst
AnnaSasDev asked this question in Q&A
Discussion options

You must be logged in to vote

Hadn't given this much thought, hence why it's locked down, but it seems sensible to me to allow code sharing if assertions want to re-use bits from other assertions.

I had to make a bit of code changes (make the GetResult method async and return a Task) - But now you could do this:

            var stringEqualsAssertCondition = new StringEqualsExpectedValueAssertCondition(expected, stringComparison);

            if(withTrimming)
            {
                stringEqualsAssertCondition.WithTrimming();
            }

            if(ignoreWhiteSpace)
            {
                stringEqualsAssertCondition.IgnoringWhitespace();
            }

            return await stringEqualsAssertCon…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AnnaSasDev
Comment options

@AnnaSasDev
Comment options

@thomhurst
Comment options

Answer selected by AnnaSasDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants