title: Unit testing class
body: <p>I'm doing unit testing with a class library and I'm stuck on how to test the method that need to test scenarios like check if a password with less than 8 characters cannot be accepted, check if a password with 8 or more characters can be accepted and check if a password with space in the front cannot be accepted.</p>
  
  <p>The code below is from the class library. </p>
  
  <pre><code>public class PasswordChecker
  {
      public bool CheckPassword(string pwd)
  {
      if (pwd.Length &gt;= 8 &amp;&amp; !pwd.StartsWith(""))
      {
          return true;
      }
      else
      {
          return false;
      }
  }
  }
  </code></pre>
  
  <p>The code below is from the testing project.</p>
  
  <pre><code>using System;
  using Microsoft.VisualStudio.TestTools.UnitTesting;
  using 12kiajunPA03;
  
  namespace PasswordCheckerTest
  {
  [TestClass]
  public class PasswordCheckerTest
  {
      [TestMethod]
      public void Checkpassword()
      {
          string pwd = "1234qa1";
  
          Checkpassword password = new Checkpassword("John", pwd);
  
          try
          {
  
          }
          catch
          {
  
          }
      }
  }
  </code></pre>
  
  <p>}</p>