unit test use the "HttpContext.Current.Session" RRS feed

  • Question

  • I am now use the VS2005 to do the unit test.

    now i will test the code as blow:
    string connstring = string.Empty;

    connstring = HttpContext.Current.Session [ "Connstring" ].ToString ();

    i  use the unit test to test it as blow:
            public void GetFlowTest()
    But when i run the test programe,it has the error and the msg is blow:
    "Test method SPARuleTested.BasicDataTest.GetFlowListTest threw exception:  System.NullReferenceException: Object reference not set to an instance of an object.."
    how can i instance the "HttpContext.Current.Session " in my test programe?

    • Moved by nobugz Wednesday, June 17, 2009 10:35 AM (From:.NET Base Class Library)
    • Edited by Jason.Smith Friday, June 26, 2009 6:26 PM fixing double encoded title
    Wednesday, June 17, 2009 8:06 AM