0

我有一些测试课

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

如何添加参考以正确使用 Lists ?

4

1 回答 1

1

首先,添加对System.Collections.Generic命名空间的引用以获取通用 List<> 类。然后尝试重新编译。

于 2012-09-22T11:04:14.240 回答