Search code examples
unit-testingusingwindows-store-apps

How to add namespace in Unit Test Library(Windows store apps)?


I have some test class

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");
        }
    }
}

I have compile error

The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

and

Cannot initialize object of type 'List<string>' with a collection initializer

How to add reference for correct working with Lists ?


Solution

  • First, add a reference to the System.Collections.Generic namespace to get the generic List<> class. Then try recompiling.