Solved

unit testing in wcf

Posted on 2014-01-18
5
517 Views
Last Modified: 2014-02-09
Hi experts..

How can we do unit testing in wcf? if you can provide me an example..

will I be using wcf webservice url or wcf library dll in the test project?

thanks
meetDinesh
0
Comment
Question by:Dinesh Kumar
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 39792770
Hi meetDinesh,

your question is very open ended, wcf is a pipeline of different components, you could essentially write unit tests at any point that you might be writing your own code - you shouldnt be unit testing any of the framework code. The service initialisation in itself is difficult to unit test unless you are hosting it within a thirdparty e.g. ninject, because that entry point to inject dependencies into to initialisation constructor is hidden away if your not using a 'hosting' ioc library.

this is an old example using ioc
http://pieterderycke.wordpress.com/2011/05/09/using-an-ioc-container-to-create-wcf-service-instances/
0
 

Author Comment

by:Dinesh Kumar
ID: 39794375
Hi what do I think is we will be using the dll of the wcf library and using that to test its  methods in the test project. this test project can be made using microsoft visual studio.

will that n't be easy?
0
 
LVL 12

Expert Comment

by:deanvanrooyen
ID: 39794942
Best is just do it and see what issues arise...
0
 

Accepted Solution

by:
Dinesh Kumar earned 0 total points
ID: 39833296
Yes I tried the way I thought.. so unit testing a wcf service is easy as we just need to use the dll of the wcf library and use the namespace and classes of wcf in the unit test project.
0
 

Author Closing Comment

by:Dinesh Kumar
ID: 39845124
The solution I thought initially worked well on real project.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now