我的单元测试在c#中一直保持失败,我尝试了几种不同的方法。任何帮助将不胜感激。这只是不转换我添加到小写的书。所以测试失败单元测试未能在c中将字符串列表转换为小写#
private List<string> _number;
public Book (string[] id)
{
//_number = idents.Select (d => d.ToLower()).ToList();
_number = new List<string>(id);
_number = _number.ConvertAll (d => d.ToLower());
}
public bool Exist (string id)
{
return _number.Contains (id);
}
public void AddBook (string id)
{
_number.Add (id.ToLower());
}
_______________________________________________________________________________
[Test()]
public void TestAddBook()
{
Book id = new Book (new string[] {"ABC", "DEF"});
id.AddBook ("GHI");
Assert.AreEqual (true, id.Exist ("ghi"));
}
你在AddIdentifier中将它转换为小写吗? – artm 2014-10-20 01:23:23
不知道为什么这是倒投了,似乎是一个合法的问题。 – 2014-10-20 01:24:09
声明了“_name”变量和“AreYou”方法在哪里? – TheVillageIdiot 2014-10-20 01:29:36