Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

dotnet test - NU1101 (Unable to find )

$
0
0

I've been putting off learning how unit tests work and how to write them, and I decided to build a stock simulator, where I use unit tests. I wrote a couple simple unit tests, to check Sell and Buy methods, and dotnet build is throwing a NU1101 error, saying that the MSTests framework is nonexistent!

I already have the Microsoft.VisualStudio.TestTools.UnitTesting namespace added to the project and the test scripts, I even tried running the dotnet add package command with the MSTest information, and it still didn't work.

(In case I'm REALLY Stupid, here are my tests:

using Microsoft.VisualStudio.TestTools.UnitTesting;using StockMarket.FrontEnd;using StockMarket.BuyerType;using StockMarket.StockType;using System;using System.Collections.Generic;[TestClass]class TestFrontEnd {    [TestMethod]    public void TestBuyStock() {        List<Stock> expected = new List<Stock>() {new Stock("Apple", "AAPL")};        StockGame game = new StockGame("test");        game.BuyStock("AAPL");        List<Stock> actual = game.player.getOwnedStocks();        Assert.AreEqual(expected, actual);    }    [TestMethod]    public void TestSellStock() {        List<Stock> expected = new List<Stock>() {new Stock("Apple", "AAPL")};        StockGame game = new StockGame("test");        game.BuyStock("AAPL");        expected.Remove(new Stock("Apple", "AAPL"));        game.SellStock("AAPL");        List<Stock> actual = game.player.getOwnedStocks();        Assert.AreEqual(expected, actual);    }}

The full error is:

error NU1101: Unable to find package MSTests.TestFramework. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org

If anyone could help me figure out why I'm getting this error, that would be really helpful!

Thanks, The_Game12


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>