R# Plugin autocompletion test


I am trying to write a unit test for my auto completion plugin using the resharper test sdk (v2018.3.1)
My completion fills parameters of method which are in a nuget package.

In the test result (.cs.tmp) I don't see the results of my completion. I believe this is because the nuget package is not loaded when the resharper test framework runs.

I have tried to edit the nuget.config file in data/, and also tried to copy what is done in https://github.com/JetBrains/resharper-unity/blob/183/resharper/resharper-unity/test/src/TestUnityAttribute.cs with no success.

Is there any way to include a custom nuget / A solution  ?
Thank you !

Comment actions Permalink
Official comment

Hi Nuke!
What nuget package?
Some specific package on which you base your completion logic?
Could you provide your test sources?
You can apply custom nuget package by


on test method or class. Package must be in any nuget source provided in data/nuget.config

Comment actions Permalink

Thank you for your answer !
The package is Moq.
It seems that the completion provider (which inherits from ItemsProviderOfSpecificContext<CSharpCodeCompletionContext>) is never called.

Comment actions Permalink

Nuke, As I've said, you need apply [TestPackages("Moq/4.10.1")] attribute to your test method.
And add nuget source with this package to test/data/nuget.config. You can add nuget.org feed.

Comment actions Permalink

If you put your test project's full sources on github - I can send you PR with necessary fixes.

Comment actions Permalink

Thank you Slava.
After several days struggling, i have found a way to solve the issue : Instanciate the completion provider (inheriting from : ItemsProviderOfSpecificContext<CSharpCodeCompletionContext>) in the setup of the test, and use [TestNetFramework46] instead of [TextFixture]
This is obviously a bug; I hope this post will be useful for others...


Please sign in to leave a comment.