I want to mock HttpSession. I have created a class below so i can unit
test it. The overloaded constructor takes HttpSessionStateBase class
as parameter so i can unit test it.
But im not sure how to use Rhino to unit test "AddItemToSession"
method
public class HttpSessionManager : ISessionManager
{
private static HttpSessionStateBase _session = null;
private static HttpSessionStateBase Session
{
get
{
return _session ?? new
HttpSessionStateWrapper(HttpContext.Current.Session);
}
}
public HttpSessionManager()
{
}
public HttpSessionManager(HttpSessionStateBase session)
{
_session = session;
}
public object GetSessionItem(string key)
{
return _session[key];
}
public void RemoveSessionItem(string key)
{
_session.Remove(key);
}
public void RemoveSessionItemAt(int index)
{
_session.RemoveAt(index);
}
public bool IsItemInSession(string key)
{
return _session[key] != null;
}
public void AddItemToSession(string key, object item)
{
_session.Add(key, item);
}
public void ClearSession()
{
_session.Clear();
}
}
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en.