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

Misc improvements to ExtensionServiceTests #454

Merged
merged 1 commit into from
Aug 21, 2018
Merged

Conversation

ChrisMaddock
Copy link
Member

These tests caused me some debugging issues during #452, as they were failing on Mono only.

I've switched them over to use the newly-improved CollectionConstraint, which gives us more detailed error messages when they fail, in terms of what the collection actually looked like. I also tidied formatting/naming-conventions etc. while I was there.

@ChrisMaddock ChrisMaddock modified the milestone: 3.10 Aug 18, 2018
@ChrisMaddock ChrisMaddock self-assigned this Aug 18, 2018
Copy link
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I spent some time wondering whether the pragma warning disable 414 were still necessary (and I think they are not, but from the history I can see that they are due to Mono). Regular .NET only reports 414 if the RHS is a constant AFAICR.

}

Assert.Fail("Couldn't find known Extension {0}", typeName);
Assert.That(_serviceInterface.Extensions,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we iterated over _serviceClass.Extensions. I don't know much about this area, so why this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main aim of this was just to get a better message in CI when the test fails.

The old version failed without telling you what was actually in the collection. The new version prints what the collection currently is - allowing you to have a better idea of what caused the problem. 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all the refactorings you did in this PR you "translated" a foreach loop, e.g. foreach (IExtensionNode node in _serviceInterface.Extensions) into an assertion over the same collection Assert.That(_serviceInterface.Extensions, ....

But in this test the foreach loop was foreach (IExtensionNode node in _serviceClass.Extensions), but this was translated into Assert.That(_serviceInterface.Extensions, ..., so I was wondering why the change from _serviceClass.Extensions to _serviceInterface.Extensions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn - you're right - sorry, I missed what you were getting at. Not intentional - good catch!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisMaddock ChrisMaddock merged commit 0f6ff6e into master Aug 21, 2018
@ChrisMaddock ChrisMaddock deleted the test-improve branch August 21, 2018 20:22
@ChrisMaddock ChrisMaddock added this to the 3.10 milestone Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants