更多的问题:C# unit test code questionsC#单元测试代码问题继续在这里提问后
我发现VS单元测试testframe从public
方法治疗以同样的方式private
和protected
方法,但输精管。
下面是一个private
方法生成的代码:
/// <summary>
///A test for recordLogin
///</summary>
[TestMethod()]
[DeploymentItem("SystemSoftware.exe")]
public void recordLoginTest()
{
User_Accessor target = new User_Accessor(); // TODO: Initialize to an appropriate value
Guid userId = new Guid(); // TODO: Initialize to an appropriate value
string action = string.Empty; // TODO: Initialize to an appropriate value
Users user = null; // TODO: Initialize to an appropriate value
AndeDBEntities db = null; // TODO: Initialize to an appropriate value
bool expected = false; // TODO: Initialize to an appropriate value
bool actual;
actual = target.recordLogin(userId, action, user, db);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
问题:
[DeploymentItem("SystemSoftware.exe")]
为private
和protected
方法,为什么需要它,它是什么呢?在我的原始类/文件中,如果我指向原始方法并尝试“
Find All References
”。单元测试类/文件中的引用不会显示为private
和protected
方法,但会显示所有方法的public
方法。这是为什么?这样对吗?