2011-10-05 3 views
3

방금 ​​두더지 프레임 워크를 조사하기 시작했습니다. 처음부터 정말 좋은 경험을 얻지 못했습니다. 나는 System.Web.Mvc.dll (3 절)에 대한 몰수MVC3 (System.Web.Mvc.dll)과 함께 동작하지 않습니다.

내 문제를 설명하려고합니다을 생성 할 수없는 이유 단계별 단지 빈 생성에

  1. 솔루션 두 개의 프로젝트 (Asp.Net MVC 3 및 ​​테스트) 추가.
  2. 테스트 프로젝트에서 C : \ Program Files (Microsoft) ASP.NET \ ASP.NET MVC 3 \ System.Web.Mvc.dll) 참조를 추가하십시오.
  3. 내 테스트 프로젝트에서 System.Web.Mvc.dll의 Assoles (VS2010)를 추가하십시오.
  4. 프로젝트를 빌드하십시오.

4 단계에서 나는 내가 찾았지만 아무것도 할 수없는 모든 항목을 조사

------ Build started: Project: SampleMvcApplication.UnitTests, Configuration: Debug Any CPU ------ 
    Microsoft Moles v0.94.51023.0 - http://research.microsoft.com/moles - .NET v4.0.30319 
    Copyright (c) Microsoft Corporation 2007-2010. All rights reserved. 

    00:00:00.00> moles 
    Moles : info : metadata : ignoring reference D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication.UnitTests\MolesAssemblies\System.Behaviors.dll 
    Moles : info : metadata : ignoring reference D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication.UnitTests\MolesAssemblies\System.Moles.dll 
    Moles : info : metadata : ignoring reference D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication.UnitTests\MolesAssemblies\System.Web.WebPages.Moles.dll 
    Moles : info : configuration : diagnostic is on 
    Moles : info : metadata : loading C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll 
    Moles : info : compilation : output assembly name: System.Web.Mvc.Moles 
Moles : warning : metadata : failed to load module System.Web.Mvc.dll: 
Moles : warning : metadata : Inheritance security rules violated by type: 'System.Web.Mvc.CompareAttribute'. Derived types must either match the security accessibility of the base type or be less accessible. 
Moles : warning : metadata : Inheritance security rules violated by type: 'System.Web.Mvc.RemoteAttribute'. Derived types must either match the security accessibility of the base type or be less accessible. 
Moles : error : code : assembly contains no types or failed to load properly 
    00:00:00.20> moles generator 1 errors, 3 warnings 
C:\Program Files (x86)\Microsoft Moles\bin\Microsoft.Moles.targets(79,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Moles\bin\moles.exe" @D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication.UnitTests\obj\Debug\Moles\moles.args" exited with code -1005. 
------ Build started: Project: SampleMvcApplication, Configuration: Debug Any CPU ------ 
    Microsoft Moles v0.94.51023.0 - http://research.microsoft.com/moles - .NET v4.0.30319 
    Copyright (c) Microsoft Corporation 2007-2010. All rights reserved. 

    00:00:00.00> moles 
    Moles : info : metadata : loading C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll 
    Moles : info : compilation : output assembly name: System.Web.WebPages.Moles 
    Moles : info : code : found 71 types 
    Moles : info : code : visibility: exported or assembly(System.Web.WebPages.Moles) 
    00:00:00.34> code generation 
     Moles : info : code : generating code at D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication\obj\Debug\Moles\swwp\m.g.cs 
     00:00:00.46> stubs generation 
     Moles : info : code : generated 23 stub types 
     00:00:00.86> moles generation 
     Moles : info : code : generated 33 mole types 
    00:00:01.70> compiling 
     Moles : info : compilation : Moles assembly: D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication\MolesAssemblies\System.Web.WebPages.Moles.dll 
    00:00:02.43> moles generator 0 errors, 0 warnings 
    SampleMvcApplication -> D:\Samples\Moles\SampleMVC\SampleMvcApplication\SampleMvcApplication\bin\SampleMvcApplication.dll 
========== Build: 1 succeeded or up-to-date, 1 failed, 0 skipped ========== 

다음과 같은 오류를 얻을 (난이 문제에 대한 몇 가지 좋은 답변과 설명을 발견 did't.)

이것은 도움이되지 않습니다 (문제 유형을 제외한 해결책) Cannot use moles to mock the MVC framework

알려주십시오. 감사합니다. .

+0

나는 MVC3에 대해 사용했을 때 Pex에 버그가 있다고 생각한다. –

답변

0

단위 테스트를 사용하고 있습니까? 그렇다면 유닛 테스트에서 MVC 3 dll 참조를 가지고 있는지 확인하십시오.

+0

나는 mstests를 사용하고있다. Microsoft.VisualStudio.QualityTools.UnitTestFramework 그리고 MVC 3 dll을 프로젝트 테스트에 추가했습니다. – user863388

0

두더지 프레임 워크에 대한 참조를 직접 추가하지 않아도됩니다. 테스트 프로젝트를 만들고 테스트중인 프로젝트에 대한 참조를 추가 한 후 해당 참조를 마우스 오른쪽 버튼으로 클릭하고 Moles Assembly 추가를 선택합니다. 그러면 테스트 프로젝트의 루트에 .moles 파일이 생성됩니다. 이제 테스트 프로젝트를 작성하면됩니다.

관련 문제