-
Notifications
You must be signed in to change notification settings - Fork 152
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
Conversation
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. 🙂
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.