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

fix BeOfType and BeAssignableTo within AssertionScope (fixes #1002) #1004

Merged
merged 1 commit into from Mar 4, 2019

Conversation

Projects
None yet
3 participants
@lg2de
Copy link
Contributor

lg2de commented Mar 3, 2019

As discussed in issue #1002 I'm providing fix for BeOfType and BeAssignableTo within an AssertionScope.

While checking the current implementations I was wondering why (Not)BeOfType() and (Not)BeAssignableTo() are looking quite different. I expected similar issues in all these methods.
Can somebody explain the differences?

@lg2de

This comment has been minimized.

Copy link
Contributor Author

lg2de commented Mar 3, 2019

The CI build failed for 1a03b29. But the failed tests are running fine locally.
I assume, there is a timing issue in the test!?

@jnyrup

jnyrup approved these changes Mar 4, 2019

@jnyrup

This comment has been minimized.

Copy link
Collaborator

jnyrup commented Mar 4, 2019

I agree, you can ignore the failing test.

Regarding the difference in implementations.
BeOfType and BeAssignableTo are affirmative tests, so when they succeed AndWhichConstraint returns a more specific subject to continue asserting on.
E.g.

obj.Should().BeOfType<string>()
    .Which.Should().HaveLength(42);

On the other hand, when NotBeOfType or NotBeAssignableTo succeeds, we know that the subject can be of any type, except one.

@jnyrup jnyrup merged commit 6a8c42a into fluentassertions:master Mar 4, 2019

1 check failed

continuous-integration/appveyor/pr AppVeyor build failed
Details

@lg2de lg2de deleted the lg2de:AssertionScope branch Mar 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.