-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add tests to check if SonarQubeNavigationItem is free-threaded #4882
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -30,29 +32,49 @@ namespace SonarLint.VisualStudio.Integration.UnitTests.TeamExplorer | |||
[TestClass] | |||
public class SonarQubeNavigationItemTests | |||
{ | |||
[TestMethod] | |||
[Ignore] // Object is created successfully, but an exception when |
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.
I'll create a separate ticket for this and fix it separately.
// There's no public documentation on how these whether it's ok to create WPF artefacts like brushes | ||
// and icons in the constructor. However, this is what the VS Team Explorer implementations of this | ||
// class are doing, so we assume it's ok. | ||
// See [VS installation directory]\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.TeamExplorer.Navigation.dll |
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.
It wasn't obvious whether our code was ok or not, so I found and decompiled the VS implementations to check what they did.
[TestMethod] | ||
public void SonarQubeNavigationItem_Execute() | ||
{ | ||
// Arrange | ||
var controller = new ConfigurableTeamExplorerController(); |
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.
Miscellaneous: minor cleanup. It was trivial to replace the helper class with a mock, and add a CreateTestSubject
method.
@@ -28,6 +28,7 @@ | |||
namespace SonarLint.VisualStudio.Integration.TeamExplorer | |||
{ | |||
[TeamExplorerNavigationItem(SonarQubeNavigationItem.ItemId, SonarQubeNavigationItem.Priority, TargetPageId = SonarQubePage.PageId)] | |||
[PartCreationPolicy(CreationPolicy.NonShared)] // The VS navigations in MS.TeamFoundation.TeamExplorer.Navigation are non-shared |
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 VS components are marked as non-shared.
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.
Nice
Part of #4856