在一个IDE实例中调试Visual Studio 2010单元测试和WCF服务 [英] Debugging Visual Studio 2010 Unit Test and WCF Service in one IDE instance

查看:107
本文介绍了在一个IDE实例中调试Visual Studio 2010单元测试和WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Visual Studio 2010中创建了一个WCF服务,还有一些支持的程序集。我还创建了一个测试项目,该测试项目包含服务和支持组件的多个单元测试。现在我把它们全部放在一个解决方案中,Test项目有一个WCF服务的服务引用(http)。

I have created a WCF service in Visual Studio 2010 along with some supporting assemblies. I have also created a test project which contains multiple unit tests for the service and the supporting assemblies. Right now I have them all in one solution with the Test project having a service reference (http) to the WCF service.

如果我调试WCF服务并选择运行检查测试在我创建的测试列表中,我可以调试WCF服务没有问题。注意:在调试WCF服务时,我无法选择调试检查的测试。 (因为IDE已经在调试?)

If I debug the WCF service and select "Run checked tests" in a Test List I created, I can debug the WCF service without a problem. Note: I cannot select Debug Checked Tests while debugging the WCF service. (Because the IDE is already debugging?)

如果我在VS 2010的另一个实例中打开了Test项目,调试WCF服务,然后选择Debug Checked Tests我可以调试我的测试和WCF服务。

If I open the Test project in another instance of VS 2010, debug the WCF service and then select "Debug Checked Tests" - I can debug both my tests and the WCF service.

然而 - 我想(和我的问题)能够在单个IDE中调试我的测试和我的服务。这是可能的吗?

However - I would like to (and my question is) be able to debug my tests and my service in a single IDE. Is this possible?

推荐答案

我选择在相同的测试过程中托管wcf服务。所以测试(也许在安装夹具中)创建并打开服务主机,并在测试结束时关闭/停止服务主机。这将使调试变得轻而易举。

I choose to host the wcf service in the same test process. So the test (maybe in the setup fixture) creates and opens the service host and at the end of the test, it closes/stops the service host. This will make debugging a breeze.

这篇关于在一个IDE实例中调试Visual Studio 2010单元测试和WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆