Click here to Skip to main content
15,924,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a BasePage class which contains methods to insert/get values from viewstate,session,cache objects.
All the pages in application inherits this BasePage class
i have successfully created unit test for session/cache operation via adapter pattern.
but i am not able to unit test BasePage methods which are using ViewState object.
How can i unit test these methods too.

eg:
C#
public class BasePage:Page
{
    protected void SetValueToViewState(string key,object value)
    {
           this.ViewState.Add(key,value);
     }

   protected object GetValueFromViewState(string key)
  {
          return this.ViewState[key.Trim()];
   }
}
Posted
Updated 3-Jan-12 19:40pm
v2

1 solution

You can not use view state at other pages, view state works for same page. if any confusion tell me.
 
Share this answer
 
Comments
SAnthwal 4-Jan-12 3:10am    
Sarvesh i have a BasePage class which is inherited by all the other pages in my application.
But my problem is that i want to write unit test against the BaseClass methods.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900