Stubbing RESTful services with WCF (Part 3) - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, August 7, 2018

Stubbing RESTful services with WCF (Part 3)

A three part series. Part 1: The set-up. Setting up an example to show what we are trying to stub. Part 2: Creating a REST service stub. Part 3: Using the service stub from a test. In this final part of the series, I'll use the ServiceStub class created in Part 2 to create a full end-to-end test. I want to create an Order Query System that uses the data provided by the RESTful URI to return some consolidated data. Here is a very simple example to start with – the Order Query System provides a method that calculates how old an order is. My test code needs to bring up the service stub, populate it with some stub data, call the Order Query System and then stop the service stub.: [TestFixture] public class TestCode { private ServiceStub serviceStub; [TestFixtureSetUp] public void TestFixtureSetUp() { serviceStub = new ServiceStub(); serviceStub.Start(); } [TestFixtureTearDown] public void TestFixtureTearDown() { serviceStub.Stop(); } [Test] public void GetNumbersOfDaysSinceOrderPlaced() { DateTime orderDate = DateTime.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

.NET,Test Driven Development,WCF,Stubbing RESTful Services,TDD

No comments:

Post a Comment