I'm using VS2019 and created a NUnit test project with .net core template, then I added this code:
using NUnit.Framework;
namespace xxx
{
class Immutable
{
public Immutable(string _cur, string _addr)
{
Currency = _cur;
Address = _addr;
}
public string Currency { get; }
public string Address { get; }
[Test]
public static void Test() // reports this line has problem?
{
var m = new Immutable("usd", "us");
string s = m.Currency;
Assert.AreEqual("usd", s);
}
}
}
Build ok, but when I run it, test explorer reports this:
Test
Source: xxx.cs line 17
Duration: < 1 ms
Message:
OneTimeSetUp: No suitable constructor was found
I don't quite get what the problem is, how to fix it?
Aucun commentaire:
Enregistrer un commentaire