1
질문 : WCF 서비스 디버깅 할 수 있습니다 방법 - 내가 VS2012를 사용하여 서비스WCF 디버그 NUnit과와
내부에 중단 점 및 NUnit를/TestDriven 수를
내가, 내 테스트 벌금을 실행 한 수예를 들어 WcfHostApplication에서 Ctrl F5를 누르기 전에 서비스를 시작했습니다. Visual Studio 내에서 호스팅하고 있습니다.
Web.Config를 WcfHostConsoleApplication에 넣고 디버그를 true로 설정해 보았습니다.
이 샘플 응용 프로그램은 디버깅하지 않고 서비스를 시작하기 때문에 Ctrl + F5와 서비스를 시작하지 마십시오 here
//hack to get working as we're not using wsdl yet...mimicking what happens in wsdl
[ServiceContract(Namespace = "http://www.programgood.net/examples/2012/09/wcf")]
public interface IHelloWcfService
{
[OperationContract]
string SayHello(string msg);
}
namespace HelloWcfTests
{
[TestFixture]
public class HelloWcfServiceLibrary_Tests
{
[Test]
public void SayHello_GivenHello_ShouldReturn()
{
//in reality add Service Ref.. using another special interface called IMetaDataExchange
IHelloWcfService proxy = ChannelFactory<IHelloWcfService>.CreateChannel(
new NetTcpBinding(),
new EndpointAddress("net.tcp://localhost:9000/HelloWcfEndPoint"));
string msg = "hello";
string result = proxy.SayHello(msg);
StringAssert.StartsWith("You entered: hello", result);
}
}
}
F5 키를 사용하여 호스트 서비스를 시작하십시오. 그런 다음 테스트 코드로 가서 테스트 내부를 마우스 오른쪽 단추로 클릭하면 TestDriven.NET이 디버거를 사용하여 시작됩니다. 그리고 그것은 작동합니다! –