more questions after questions in here: http://stackoverflow.com/questions/2714073/c-unit-test-code-questions
I found the VS unit test testframe treat private
and protected
method in the same way but deferent from public
method.
The following is the generated code for a private
method:
/// <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.");
}
questions:
[DeploymentItem("SystemSoftware.exe")]
is forprivate
andprotected
methods, why needs it and what is it for?In my original class/file, if I point to the original method and try to "
Find All References
". The reference in the unit test class/file will not show up forprivate
andprotected
methods but it will show up for allpublic
methods. Why is that? Is it right?