locked
Unit tests - Testing ASP.NET Session RRS feed

  • Question

  • Hi,

    I have some business logic classes I need to test that are using System.Web.HttpContext.Current.Session, and "System.Web.HttpContext.Current" is always null. Someone knows if I could initiate a httpcontext for a unit test?

     

    Thanks


    Jesús Bosch Aiguadé
    http://geeks.ms/blogs/jbosch
    http://uoc.dotnetclubs.com
    Wednesday, May 12, 2010 5:13 PM

Answers

  • Sorry, I found the solution..

     

    [

    HostType("ASP.NET")]

    [

    AspNetDevelopmentServerHost(@"Z:\WebTest\WebApplication1\WebApplication1",@"/")]

    [

    UrlToTest(@"http://localhost:49655/Default.aspx")]

    [

    TestMethod()]

    But the problem is that I can't debug those unit tests, only run them, any Idea?.


    Jesús Bosch Aiguadé
    http://geeks.ms/blogs/jbosch
    http://uoc.dotnetclubs.com
    • Marked as answer by Figo Fei Thursday, May 13, 2010 3:10 AM
    Wednesday, May 12, 2010 5:22 PM