C
C#8mo ago
olayk

Help with sorting package issues in Visual Studio.

I am trying to follow the walkthrough for Test-driven development using Test Explorer here: https://learn.microsoft.com/en-us/visualstudio/test/quick-start-test-driven-development-with-test-explorer?view=vs-2022#create-a-test-and-generate-code The problem I have is that the TestClass references that are supposed to be highlighted after creating the MSTest project template aren't there (see image1). This seems to be because it cannot find the up to date dependencies (see image 2). I tried going to Tools>NuGet Package Manager>Manage NuGet Packages for Solution, and am confused as I can see that the correct packages and versions are in the "Installed" tab, but labelled as "Not available in this source" (see image3) How can I fix this issue? Many thanks.
Test-driven development walkthrough - Visual Studio (Windows)
Learn how to develop a tested method in C# using Microsoft Test Framework, which you can easily adapt for other languages or test frameworks, such as NUnit.
No description
No description
No description
7 Replies
Pobiega
Pobiega8mo ago
Hm. Can't really say, but I would highly recommend using XUnit instead of MSTest these days everything else will be roughly the same, its just slightly less attributes
olayk
olaykOP8mo ago
im just looking to follow the tutorial in the post i fixed this issue myself by adding https://api.nuget.org/v3/index.json to the nuget package sources and installing via there and then running build and swapping back to the local package source
Pobiega
Pobiega8mo ago
ah, thats the default source, dunno why it wasnt already in
olayk
olaykOP8mo ago
yeah not sure either, the walkthrough didnt mention it but at least now i have some underestanding of nuget package manager that i didnt befoe
Pobiega
Pobiega8mo ago
great! did you get your unittests working?
olayk
olaykOP8mo ago
yep, all working fine. ive swapped to NUnit in a different project now that ive got it woking but tbh the main idea was to do a bit of TDD as I need to use it in an upcoming interview and ive never used Visual Studio before, only VScode
Pobiega
Pobiega8mo ago
nunit (and Xunit, the even better choice) also have great integration with VS so you're not forced to use mstest, and I would indeed recommend not using it xunit has ~50% of the market, nunit ~40%, and mstest the last 10%
Want results from more Discord servers?
Add your server