After adding JustMock project, all references show error

1 Answer 208 Views
General Discussions
Steve
Top achievements
Rank 1
Steve asked on 19 Sep 2021, 11:07 PM

I added C# JustMock Test Project (.NET Framework) to my solution. The resulting project has five references Microsoft.VisualStudio.TestPlatform.TestFramework, Microsoft.VisualStudio.TestPlatform.TestFrameworkExtensions, System, System.Core and Telerik.JustMock. All of the references had the yellow alert icon next to them. Looking at the properties, none showed a Path.

I was surprised to see System.Core as a reference, since I selected the .NET Framework project. To verify, I removed that project and added a new Test Project, verifying I selected the .NET Framework. Same results.

As a test, I added a VB.NET JustMock Test Project (.NET Framework). It had two erroring references – the Microsoft TestPlatforms. Using NuGet Package Manager, I updated them both from 1.4.0 to 2.2.7. That eliminated the error.

I used NuGet to update the same two references in my C# project, but they still show errors. I also tried removing the reference to Telerik.JustMock.dll and re-adding it by browsing to the file. Still shows error.

Finally, my VB.NET project builds, but my C# build errors with this message: “This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\MSTest.TestAdapter.1.3.2\build”. Doing the package restore does not resolve this message.

Any thoughts as to how I can resolve this? Thanks in advance.

Steve.

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 20 Sep 2021, 01:32 PM

Hello Steve,

The JustMock project template is based on the unit test project template that comes with Visual Studio by default. This is why you see the System.Core reference there. If you point out the path you will notice that it is a DLL from the .NET Framework.

You should definitely update the packages as in some VS versions the project correctly builds but the test explorer fails to execute them as it does not recognize them. We are aware of this issue and with our upcoming service pack, R3 SP1 2021 will provide an update to the project templates.

Regarding the issue itself with VS failing to obtain the nugget packages, I've experienced the same issue on several occasions with different types of projects. You can google few tips on how to solve it but for me, nothing concrete worked. I managed to fix the issue by building the project a few times + restarting Visual Studio. I believe that the main problem is that VS occurs an issue with its nuget chasing mechanisms. Updating VS to the latest version is highly recommended as well.

Alternatively, you could create a unit test project for .NET Framework with the default project template from VS and just add the JustMock DLL for .NET Framework. In essence, this is what the JustMock template does. The DLL for .NET Framework is typically located at "C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\Telerik.JustMock.dll".

I hope this information is somewhat helpful.

Regards,
Mihail
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Steve
Top achievements
Rank 1
commented on 20 Sep 2021, 11:15 PM

Mihail, thanks for the prompt reply. I went the easy route and created a new C# test project using the VS template, then added the JustMock dll. Everything's working great! (Or at least it compiles. Now on to adding tests!)

Thanks again for the help.

Steve.

Mihail
Telerik team
commented on 21 Sep 2021, 07:01 AM

Hi Steve,

I am happy to help.

If you have any feedback about JustMock or its documentation, I am more than willing to hear it.

Tags
General Discussions
Asked by
Steve
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or