C# unit test code questions continue

Posted by 5YrsLaterDBA on Stack Overflow See other posts from Stack Overflow or by 5YrsLaterDBA
Published on 2010-04-26T16:02:55Z Indexed on 2010/04/26 16:03 UTC
Read the original article Hit count: 490

Filed under:
|

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 with 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:

  1. [DeploymentItem("SystemSoftware.exe")] is for private and protected methods, why needs it and what is it for?

  2. 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 for private and protected methods but it will show up for all public methods. Why is that? Is it right?

  3. 3.

© Stack Overflow or respective owner

Related posts about c#

Related posts about unit-testing