R# Plugin autocompletion test

Hello,

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 !

5 comments
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

TestPackagesAttribute 

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

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

1

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.

0

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

0

Hi,
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...

0

Please sign in to leave a comment.