title: Can I access SessionState from within an NUnit test?
body: <p>One of my methods in an NUnit test checks a Session-State variable :</p>
  
  <p>if (Sesssion[variableName] == null) ... </p>
  
  <p>and the NUnit test is failing with err: </p>
  
  <blockquote>
    <p>System.Web.HttpException: Session
    state can only be used when
    enableSessionState is set to true,
    either in a configuration file or in
    the Page directive. Please also make
    sure that
    System.Web.SessionStateModule or a
    custom session state module is
    included in the
    \\
    section in the application
    configuration.</p>
  </blockquote>
  
  <p>I tried taking the test method out of a class library and putting it into the codebehind cs of an aspx page that set EnableSessionState="True" in the aspx page directive.  Added a web config with  sessionState mode = "InProc" in the web config, then tried &lt; pages enableSessionState ="true"/> in the web.config. </p>
  
  <p>Nunit tests still failed on the session state action. </p>
  
  <p>Do I have to mock these out? </p>