Search code examples
c#visual-studionunit

Nunit Test. Visual Studio. Namespace , class issue


.I m very new to programming, and I think I'm loosing my mind trying to understand what's the problem here. Does Anyone have any suggestions?

The Test Project has Reference set to OrderManagementSystem.Domain and OrderManagementSystem.Controllers. The Controllers Class is Public . Im able to access Classes from Domain Namespace , but not Controllers?? What did i do wrong?

enter image description here


Solution

  • This error is because your class name is Controllers and namespace also contains .Controllers.

    Either update the name of class or remove .Controllers from the namespace OrderManagementSystem.Controllers

    In Controllers.cs file,

    using Systems;
    ....
    
    //Remove .Controllers from namespace
    namespace OrderManagementSystems
    {
        public class Controllers
        {
              //Your code
        }
    }