2011-10-19 3 views
0

저는 팀에서 사용하는 레거시 코드에 대한 모의 클래스를 생성하기 위해 두더지를 사용하고 있습니다. 의회에서 특정 계급을 도둑질하는 것을 배제 할 수 있습니까? 나는 멀어지기를 원하지 않는 레거시 코드에서 생성 한 자동 생성 클래스에 대해 많은 오류가 발생합니다.어셈블리에서 파일을 제외하는 것을 제외했습니다.

+0

오류를 보여주기 위해 –

답변

4

스텁/몰 생성에서 유형을 포함 및 제외하려면 어셈블리에 대한 .moles 파일을 수정해야합니다. 참조 설명서의 "유형 필터링"절에 StubGeneration 요소 만 설명되어 있지만 비슷하게 작동하지만 mole 생성을 관리하는 MoleGeneration 요소가 있습니다. 어셈블리에 대한 .moles 파일은 다음과 같이 보이도록

Remove 요소의 유형 이름을 지정 스텁과 몰 세대에서 유형을 제외하려면 다음

<Moles xmlns="http://schemas.microsoft.com/moles/2010/" Diagnostic="true"> 
    <Assembly Name="your_assembly" /> 
    <StubGeneration> 
     <Types> 
      <Remove FullName="Your.Type.Full.Name!" /> 
     </Types> 
    </StubGeneration> 
    <MoleGeneration> 
     <Types> 
      <Remove FullName="Your.Type.Full.Name!" /> 
     </Types> 
    </MoleGeneration> 
</Moles> 
다음

스텁과 몰 생성 할 수 있도록하는 방법 만 한 클래스의 경우 Your.Type.Full.Name :

<Moles xmlns="http://schemas.microsoft.com/moles/2010/" Diagnostic="true"> 
    <Assembly Name="your_assembly" /> 
    <StubGeneration> 
     <Types> 
      <Clear /> 
      <Add FullName="Your.Type.Full.Name!" /> 
     </Types> 
    </StubGeneration> 
    <MoleGeneration> 
     <Types> 
      <Clear /> 
      <Add FullName="Your.Type.Full.Name!" /> 
     </Types> 
    </MoleGeneration> 
</Moles>