Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your <code>addDateToList</code> method is implementation detail. What you want and should test is <code>ReadTheXmlFile</code> method. You even already spotted what should be tested:</p> <blockquote> <p>Find default file, if it doesn't exist, ask user for file through Openfiledialog and open XMLDocument + error handling if XMLdocument is empty etc.</p> </blockquote> <ul> <li>test what happens when find fails (this sounds like external dependecy job tho)</li> <li>test error handling</li> <li>test XML document being empty</li> <li>test propert XML is returned upon success (this will implicitly test private methods)</li> </ul> <p>And about this:</p> <blockquote> <p>I could of course test the public method ReadTheXmlFile(), but then I'd have to make specific test cases for each outcome of error detection, and in my opinion I wouldn't properly test the actual intake of data into the list.</p> </blockquote> <p>That's what you should indeed do. If your method has multiple possible error outcomes, each should be tested. It doesn't get any simplier than that. Most frameworks make this (multiple input/output testing) really easy with attributes such as NUnit's <a href="http://nunit.org/?p=testCase&amp;r=2.5" rel="nofollow">TestCase</a>.</p> <p>On a sidenote, if you find yourself in strong need of testing private method, it's usually good indicator that your class is doing too much stuff and extracting private method's functionality to external object might be worth considering.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload