C# Class Sage.Test.Mother

Mocks various MVC and HTTP objects.
ファイルを表示 Open project: igorfrance/sage

Public Methods

Method Description
CreateHttpContext ( string url ) : System.Web.HttpContextBase
CreateHttpContext ( string url, string physicalPath ) : System.Web.HttpContextBase
CreateHttpRequest ( ) : System.Web.HttpRequestBase

Creates a new fake HTTP request with its url and physicalPath properties set to null.

CreateHttpRequest ( string url, string physicalPath ) : System.Web.HttpRequestBase

Creates a new fake HTTP request with its url and physicalPath properties set to specified values.

CreateMockController ( ) : SageController
CreateRequestContext ( System.Web.HttpContextBase httpContext ) : System.Web.Routing.RequestContext

Creates a new request context.

CreateRequestContext ( System.Web.HttpContextBase httpContext, System.Web.Routing.RouteData routeData ) : System.Web.Routing.RequestContext

Creates a new request context.

CreateRequestContext ( string url ) : System.Web.Routing.RequestContext

Creates a new request context, using the specified request url.

CreateRequestContext ( string category, string locale ) : System.Web.Routing.RequestContext

Creates a new request context, using the specified category and locale.

CreateSageContext ( string url ) : SageContext

Creates a new fake SageContext instance using the specified url.

CreateSageContext ( string url, string>.Func pathMapper ) : SageContext

Creates a new fake SageContext instance.

CreateSageContext ( string category, string locale ) : SageContext

Creates a Sage context using the specified category and locale.

CreateSageContext ( string category, string locale, System.Web.QueryString query ) : SageContext

Creates a Sage context using the specified category, locale and query.

CreateSageContext ( string category, string locale, string query ) : SageContext

Creates a Sage context using the specified category, locale and query.

CreateUri ( string url ) : Uri
SetHttpMethodResult ( this request, string httpMethod ) : void

Sets the HttpRequest.HttpMethod value to the specified string.

SetupRequestUrl ( this request, string url ) : void

Sets the various URL-related properties of the to parts of the specified URL.

Private Methods

Method Description
GetQueryStringParameters ( string url ) : NameValueCollection

Given a URL, returns the just the query string part.

GetUrlFileName ( string url ) : string

Given a URL, returns the name without the query string part.

MapPath ( string path ) : string

Method Details

CreateHttpContext() public static method

public static CreateHttpContext ( string url ) : System.Web.HttpContextBase
url string
return System.Web.HttpContextBase

CreateHttpContext() public static method

public static CreateHttpContext ( string url, string physicalPath ) : System.Web.HttpContextBase
url string
physicalPath string
return System.Web.HttpContextBase

CreateHttpRequest() public static method

Creates a new fake HTTP request with its url and physicalPath properties set to null.
public static CreateHttpRequest ( ) : System.Web.HttpRequestBase
return System.Web.HttpRequestBase

CreateHttpRequest() public static method

Creates a new fake HTTP request with its url and physicalPath properties set to specified values.
public static CreateHttpRequest ( string url, string physicalPath ) : System.Web.HttpRequestBase
url string The URL.
physicalPath string The physical path.
return System.Web.HttpRequestBase

CreateMockController() public static method

public static CreateMockController ( ) : SageController
return Sage.Controllers.SageController

CreateRequestContext() public static method

Creates a new request context.
public static CreateRequestContext ( System.Web.HttpContextBase httpContext ) : System.Web.Routing.RequestContext
httpContext System.Web.HttpContextBase The HTTP context to use with the resulting context.
return System.Web.Routing.RequestContext

CreateRequestContext() public static method

Creates a new request context.
public static CreateRequestContext ( System.Web.HttpContextBase httpContext, System.Web.Routing.RouteData routeData ) : System.Web.Routing.RequestContext
httpContext System.Web.HttpContextBase The HTTP context to use with the resulting context.
routeData System.Web.Routing.RouteData The route data to use with the resulting context.
return System.Web.Routing.RequestContext

CreateRequestContext() public static method

Creates a new request context, using the specified request url.
public static CreateRequestContext ( string url ) : System.Web.Routing.RequestContext
url string The URL.
return System.Web.Routing.RequestContext

CreateRequestContext() public static method

Creates a new request context, using the specified category and locale.
public static CreateRequestContext ( string category, string locale ) : System.Web.Routing.RequestContext
category string The category for which to create the fake context.
locale string The locale for which to create the fake context.
return System.Web.Routing.RequestContext

CreateSageContext() public static method

Creates a new fake SageContext instance using the specified url.
public static CreateSageContext ( string url ) : SageContext
url string The URL to use when creating the new context.
return SageContext

CreateSageContext() public static method

Creates a new fake SageContext instance.
public static CreateSageContext ( string url, string>.Func pathMapper ) : SageContext
url string The URL to use within the created context.
pathMapper string>.Func The function to use for resolving relative paths.
return SageContext

CreateSageContext() public static method

Creates a Sage context using the specified category and locale.
public static CreateSageContext ( string category, string locale ) : SageContext
category string The category to set on the context being created.
locale string The locale to set on the context being created.
return SageContext

CreateSageContext() public static method

Creates a Sage context using the specified category, locale and query.
public static CreateSageContext ( string category, string locale, System.Web.QueryString query ) : SageContext
category string The category to set on the context being created.
locale string The locale to set on the context being created.
query System.Web.QueryString The query string of the fake request to create.
return SageContext

CreateSageContext() public static method

Creates a Sage context using the specified category, locale and query.
public static CreateSageContext ( string category, string locale, string query ) : SageContext
category string The category to set on the context being created.
locale string The locale to set on the context being created.
query string The query string of the fake request to create.
return SageContext

CreateUri() public static method

public static CreateUri ( string url ) : Uri
url string
return System.Uri

SetHttpMethodResult() public static method

Sets the HttpRequest.HttpMethod value to the specified string.
public static SetHttpMethodResult ( this request, string httpMethod ) : void
request this The request to modify.
httpMethod string The HTTP method to set.
return void

SetupRequestUrl() public static method

Sets the various URL-related properties of the to parts of the specified URL.
If the is null.
public static SetupRequestUrl ( this request, string url ) : void
request this The request to modify.
url string The URL to set.
return void