WCF 서비스를 만들고 메서드 중 하나를 테스트하려고했습니다. WCF 서비스 메서드를 마우스 오른쪽 단추로 클릭하고 단위 테스트 만들기를 선택했습니다.단위 테스트 WCF 메서드
새로운 테스트 프로젝트를 만들고 단위 테스트를 만들었습니다.
테스트 프로젝트를 실행하려고했지만 UrlToTest
값이 무엇인지 확실하지 않습니다. 나는 서비스에 URL을 썼다.
[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("C:\\VS Projects\\NetBranch4\\" +
"MobileCheckCapture\\MobileCheckCapture", "/")]
// [UrlToTest("http://localhost:45651/")]
[UrlToTest("http://localhost/mobilecc/mobilecc.svc")]
public void AuthenticateUserTest()
{
// TODO: Initialize to an appropriate value
MobileCC target = new MobileCC();
// TODO: Initialize to an appropriate value
string authenticateRequest = string.Empty;
// TODO: Initialize to an appropriate value
string expected = string.Empty;
string actual;
actual = target.AuthenticateUser(authenticateRequest);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
는 지금 작동 감사하지만 실제 = 대상에 브레이크 포인트를 뒀다 : 로컬 IIS에 당신에게 SVC를 호스팅하는 경우
, 시험 방법의 코드는 유사합니다 .AuthenticateUser (authenticateRequest); 그것은 깨지 않고 wcf 메서드를 디버그하자 – user228777
VS 메뉴에서 테스트 이동 "현재 컨텍스트에서 디버그 -> 테스트"선택하십시오. VS의 Test Tools 도구 모음에서 Test를 실행하기위한 옵션도 있습니다. –
디버그 메뉴의 현재 컨텍스트에서 테스트 옵션이 표시되지 않습니다. 옵션을 설정해야합니까? Thanks – user228777