Files
spring-net/test/Spring/Spring.Web.Tests/TestSupport/SessionMock.cs
eeichinger 733402b15f performance improvements
fixed SynchronizedHashtable
SPRNET-974: support private ctors with ConstructorNode
SPRNET-975: treat alias case insensitive as well
SPRNET-976: defered registering WebObjectFactory event handlers with VirtualEnvironment to when they are really needed
SPRNET-977: avoid unnecessary usages of HttpContextSwitch in WebObjectFactory.ConfigureObject()
added tests
added VirtualEnvironment HttpSessionState/HttpRequest abstraction
2008-07-20 12:10:15 +00:00

89 lines
2.1 KiB
C#

using System;
using System.Collections;
using System.Web;
using System.Web.SessionState;
using Spring.Util;
namespace Spring.TestSupport
{
/// <summary>
/// Test Session implementation
/// </summary>
public class SessionMock : Hashtable, ISessionState
{
private bool _isCookieless;
private bool _isNewSession;
private int _lcid;
private SessionStateMode _mode;
private string _sessionID;
private int _codePage;
#if NET_2_0
private HttpCookieMode _cookieMode;
#endif
public SessionMock() : base(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default)
{
Reset();
}
protected virtual void Reset()
{
_sessionID = Guid.NewGuid().ToString();
_isNewSession = false;
_isCookieless = false;
_mode = SessionStateMode.InProc;
_codePage = -1;
#if NET_2_0
_cookieMode = HttpCookieMode.AutoDetect;
#endif
}
public void Abandon()
{
Reset();
}
public bool IsCookieless
{
get { return _isCookieless; }
set { _isCookieless = value; }
}
public bool IsNewSession
{
get { return _isNewSession; }
set { _isNewSession = value; }
}
public int LCID
{
get { return _lcid; }
set { _lcid = value; }
}
public SessionStateMode Mode
{
get { return _mode; }
set { _mode = value; }
}
public string SessionID
{
get { return _sessionID; }
set { _sessionID = value; }
}
public int CodePage
{
get { return _codePage; }
set { _codePage = value; }
}
#if NET_2_0
public HttpCookieMode CookieMode
{
get { return _cookieMode; }
set { _cookieMode = value; }
}
#endif
}
}