1
나는 직장에서 프로젝트에 채택되도록 (잘하면) 가정용 프로젝트에서 Moles를 시도하고 있습니다. 나는 VS 10.0.30319와 Moles 1.0.0.0을 가지고 일하고있다.두더지가 잘린 방법이 필요합니다.
나는 다음 클래스 만든 : 내 테스트 클래스에서
public class DeveloperTestControlBL
{
public static bool VerifyCurrentDevelopmentStatus(int tpid, int testStatusID)
{
return false; // For this example, always return false,
// so that a return of true means the delegation worked
}
}
을, 나는 VerifyCurrentDevelopmentStatus 메소드를 호출하는 클래스를 테스트하는 테스트를 만들었습니다. 나는 형태의 선언이 예상 한 것 : 내가 발견 한 것은 그게 내가이 작업을 수행해야하는 대리자를 설정하는 것입니다
[TestMethod]
[HostType("Moles")]
public void TestPreTCIToEditReady_WithMoles()
{
var devTCBL = new SDeveloperTestControlBL();
devTCBL.VerifyCurrentDevelopmentStatus = delegate(int tpid, int testStatusID)
{
return true;
}
// rest of the test here
}
:
이[TestClass]
public class MyTest
{
[TestMethod]
[HostType("Moles")]
public void TestPreTCIToEditReady_WithMoles()
{
DelegateExample.Moles.MDeveloperTestControlBL.VerifyCurrentDevelopmentStatusInt32Int32 =
VerifyCurrentDevelopmentStatusAlwaysTrue;
// Rest of the test here
}
private bool VerifyCurrentDevelopmentStatusAlwaysTrue(int tpid, int status)
{
return true;
}
사람이에 관해서는 어떤 조언이 있습니까 무엇을 내가 잘못하고 있니? 저는 을 Microsoft.Moles.Framework를 사용합니다. 테스트 프로젝트의 DeveloperTestControlBL.Moles에 대한 참조가 있어야합니다. 사전에
감사합니다, 론 L