title: How to test a protected method?
body: <p>I have an ASP.NET page that is the base to many more derived pages and it contains the following protected method</p>
  
  <pre><code>protected Change SetupApproval(string changeDescription)
  {
      Change change = Change.GetInstance();
      change.Description = changeDescription;
      change.DateOfChange = DateTime.Now;
      change.MadeBy = Common.ActiveDirectory.GetUsersFullName(AccessCheck.CurrentUser());
      change.Page = PageName;
      return change;
  }
  </code></pre>
  
  <p>I want to write the following Unit test</p>
  
  <pre><code>[TestMethod]
  public void SetupApproval_SubmitChange_ValidateDescription()
  {
      var page = new DerivedFromBaseClass();
      var messageToTest = "This is a test description";
  
      var change = (page as InternalAppsPage).SetupApproval(messageToTest);
  
      Assert.IsTrue(messageToTest == change.Description);
  }
  </code></pre>
  
  <p>I'm sure there's a lot wrong with this code (so feel free to suggest corrections), but my main goal is to start implementing some tests for this entire project.  I decided to start small - one method at a time.  I first tried creating a new Test Project, but then I can't access the SetupApproval method because it is protected.  My next attempt was to put the TestMethod inside of the base page, but then there's no way to Run Tests.  </p>
  
  <p>Lastly, I'm using Visual Studio 2008's default test framework.  </p>