我有一些测试类
using System;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Praktyka.Models;
namespace PraktykaTest
{
[TestClass]
public class PictureManagerTest
{
[TestMethod]
public void LoadImagesTest()
{
var pic = new PictureManager();
pic.LoadImages(new List<String>
{
"1.jpg",
"2.jpg"
});
// Assert.AreEqual(@"dataImages\1.jpg",pic.Current().UriSource);
Assert.AreEqual("test","test");
}
}
}
我有编译错误
The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
和
Cannot initialize object of type 'List<string>' with a collection initializer
如何添加引用以正确使用列表?
答案 0 :(得分:1)
首先,添加对System.Collections.Generic
命名空间的引用以获取通用List&lt;&gt;类。然后尝试重新编译。