ID

Uploaded

Status

Description

Work Items

Action

6827
by DevilDog74
Sep 18, 2010
10:52 PM

Being evaluated

This is really more of a working sample on how to use WCFMock in the context of NUnit and Rhino Mock. My preferred testing tools are NUnit and RhinoMock, so this patch simply demonstrates how to use WCFMock with NUnit and RhinoMock.
I created a simple REST Service that returns a single person object as XML. The key things being demonstrated here are how to set values on WebOperationContext, OutgoingResponse, and IncomingRequest using RhinoMock
Patch Notes:
• Upgraded the solution to VS2010 format
• Upgraded all projects to compile against .NET 4.0
• Added a real RESTful WCF Service Implementation called SampleWCFService
• Added a test project for SampleWcfService named SampleWcfService.Test.Nunit
If you compile and start the Person.svc you can issue the following request in fiddler:
GET /Person.svc/firstName/joe/lastName/bloggs HTTP/1.1
User-Agent: Fiddler
Content-Type: application/xml
Authorization: someauthorization_string
Host: 127.0.0.1.:8482

Issuing the request above should return these results…
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Sat, 18 Sep 2010 21:49:14 GMT
X-AspNet-Version: 4.0.30319
Content-Length: 223
Cache-Control: private
Content-Type: application/xml; charset=utf-8
Connection: Close

<PersonData xmlns="http://wcfmock.com/person" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Email>jbloggs@gmail.com</Email><FirstName>joe</FirstName><LastName>bloggs</LastName><Phone>111-222-3333</Phone></PersonData>

7201

Download

View All
  • 1-1 of 1 Patches
    • Previous
    • 1
    • Next
    • Showing
    • All
    • Patches