Classes not recognized in their unit test code

답변됨 Classes not recognized in their unit test code

  • 2012년 5월 1일 화요일 오후 7:19
     
     
    I have a C# class library, which I'll call "MyLibrary," for which I have made a unit test project, which I will call "MyLibrary.Test." MyLibrary contains several class definitions. Currently, all of these references are broken. Specifically, they are marked with the error "The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)." Both the using directive and the assembly reference are present, like so:

    using System;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using MyLibrary;

    namespace MyLibrary.Test
    {
        /// <summary>
        /// Test class for MyLibrary.MyClass.
        /// </summary>
        [TestClass()]
        public class MyClassTest
        {

            private TestContext testContextInstance;
            public TestContext TestContext [...]

            internal virtual MyClass CreateMyClass()
            {
                [...]
            }

    What is the problem and how do I resolve it?

모든 응답