title: .Net core library: How to test private methods using xUnit
body: <p>The latest xunit framework does not allow test runners in library code when compiled with .Net Core framework (this is allowed for normal Visual Studio code). The solution is to create a separate testing project to run your test cases.</p>
  
  <p>The problem that I am having is that some methods that I want to test are 'private' methods. <strong>How can I call those methods from my test project without making their scope 'public'?</strong> </p>
  
  <p>The more general question is: <strong>How do you test private methods when the public method that uses the private method can not be used?</strong> (because of its interactive nature - that is, it has a ReadLine(); contained in it)</p>
  
  <hr>
  
  <p><strong>Possible solutions:</strong><br>
  1) Make the private methods public and rename them in a manner to indicate that they should not be used externally. (Use 'private' or 'internal' as part of the name) <br>
  2) Create a ' public static bool Testflag' field that can be set to true in order to bypass the interactive parts of the public method to ensure testing of all its parts.</p>
  
  <p>(Although I have used both of the above methods - I really do not like it because private methods should stay private and flags add a lot of extra complexities. Has someone encountered the same problem? How did you solved it? </p>