简体   繁体   English

单元测试。 视觉工作室。 命名空间,class 问题

[英]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.测试项目的 Reference 设置为 OrderManagementSystem.Domain 和 OrderManagementSystem.Controllers。 The Controllers Class is Public.控制器 Class 是公共的。 Im able to access Classes from Domain Namespace, but not Controllers??我能够从域名空间访问类,但不能访问控制器? What did i do wrong?我做错了什么?

在此处输入图像描述

This error is because your class name is Controllers and namespace also contains .Controllers .此错误是因为您的 class 名称是Controllers并且命名空间也包含.Controllers

Either update the name of class or remove .Controllers from the namespace OrderManagementSystem.Controllers更新 class 的名称或从命名空间OrderManagementSystem.Controllers中删除.Controllers

In Controllers.cs file,在 Controllers.cs 文件中,

using Systems;
....

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Nunit测试在Team City中失败,但可以在Visual Studio中使用。 无法找到程序集,DLL在哪里? - Nunit test fails in Team City but works in Visual Studio. Unable to find assembly , Where are the DLL's? 单元测试,NUnit或Visual studio? - Unit test, NUnit or Visual studio? 在 Visual Studio 2017 上通过 Selenium 执行 Nunit 测试时,找不到类型或命名空间名称“IWebDriver”错误 - The type or namespace name 'IWebDriver' could not be found error while executing Nunit test through Selenium on Visual Studio 2017 使用Nunit测试适配器在Visual Studio 2013中按类名称和方法名称进行分组测试 - Group test by class name and method name in visual studio 2013 with Nunit test adapter 如何在Visual Studio 2010中调试Nunit测试 - How to debug Nunit test in Visual Studio 2010 使用nunit,xunit或Visual Studio测试拆分测试定义和测试实现 - split test definition and test implementation with nunit, xunit or visual studio test 避免在Visual Studio中自动生成名称空间。 如何关闭“使用系统”的自动插入 - Avoid auto generated namespace in Visual Studio. How to turn off automatic insertion of “using System;” 无法读取csv文件的第一列以进行数据驱动测试。 Visual Studio 2017 - Cannot read first column of csv file for data driven test. Visual Studio 2017 Visual Studio Test Explorer Group,名称为Namespace - Visual studio Test Explorer Group by name Namespace Visual Studio 2013/2015测试项目模板 - 适用于NUnit? - Visual Studio 2013/2015 Test Project Template - for NUnit?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM