GetAwesomeResultsAsXml()
次の WCF Rest Service 用に書かれた単体テスト (より多くの統合テスト) を取得しようとしています。嘲笑
の側面にどう対処すればよいですか?
最善のアプローチは何ですか? WebOperationContext
public class AwesomeRestService : AwesomeRestServiceBase, IAwesomeRestService
{
public AwesomeSearchResults<AwesomeProductBase> GetAwesomeResultsAsXml()
{
return GetResults();
}
private static AwesomeSearchResults<AwesomeProductBase> GetResults()
{
var searchContext = AwesomeSearchContext
.Parse(WebOperationContext.Current);
..............
..............
..............
}
}
[ServiceContract]
public interface IAwesomeRestService
{
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/search/xml")]
AwesomeQueryResults<AwesomeProductBase> GetAwesomeResultsAsXml();
}
public class AwesomeSearchContext
{
................
................
................
public static AwesomeSearchContext Parse
(WebOperationContext operationContext)
{
return WebOperationContext.Current != null ? new
AwesomeSearchContext(operationContext.IncomingRequest.UriTemplateMatch.QueryParameters) : null;
}
}