Moles adding assembly to wrong project

落花浮王杯 提交于 2019-12-24 10:55:17

问题


I'm trying to get started with Microsoft Moles in order to be able to mock my extension methods, but I'm falling short.

I've successfully installed Moles on my workstation, but when I go to my test project (a class library project referencing NUnit, not an MSTest project), navigate down through References, right-click the assembly I want to stub (NHibernate in this case) and click "Add moles assembly...", the NHibernate.moles file shows up in an entirely different project in my solution. It's only content is

<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
  <Assembly Name="NHibernate" />
</Moles>

This doesn't seem to get me anywhere. I expected to be able to follow this screencast from Dime Casts to get started, but I don't have the "Moles and Stubs for Testing" item template shown in the screencast.

I don't seem to be able to get anywhere from here. What do I need to do to get those templates? And why does the moles "assembly" end up in the wrong project? How do I proceed from here to be able to start using Moles?


回答1:


The mole assemblies don't show up at the beginning in your References folder. Build the project, click "Show All Files" and you'll see a MolesAssemblies folder containing your generated Mole assemblies.



来源:https://stackoverflow.com/questions/6569956/moles-adding-assembly-to-wrong-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!