问题
Update 6/20/2011 I can only build the test project once or twice before getting this error. Moles is unusable for me until this is resolved. Deleting obj/bin and closing/reopening visual studio isn't practical.
The Error
Error 32 The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" @C:\src\qp\mvc3\Solution\QP.Tests.Moles\obj\Debug\Moles\moles.args" exited with code -1002. QP.Tests.Moles
The Description
Was trying to use moles with nunit but had trouble... so I created a new mstest project with a single test. The test built and I was able to debug into the SUT and verify HttpContext contained values expected. Subsequent attempts to build the test project fail with the above.
note: I am running resharper 6 EAP (i know, i know) but I have disabled it's mstest runner. besides, this is a build error.
What I've Tried
Have tried rebuild, clean and deleting obj/bin directories in the test project.
The Code
namespace QP.Tests.Moles
{
[TestClass]
public class UnitTest1
{
[TestMethod]
[HostType("Moles")]
public void TestMethod1()
{
INewsService _newsService = new NewsService();
BHttpContext context = BHttpContext.SetCurrent();
BIPrincipal user = context.SetUser();
BIIdentity identity = user.SetIdentity();
identity.Name = "AMole";
var newsItemViewModel = new NewsItemViewModel()
{
Headline = "some headline that passes validation",
FullMessage = "some full message that passes validation",
ProviderListItems = new List<SelectListItem>()
{
new SelectListItem()
{
Selected = false,
Text = "some text",
Value = "some value"
}
}
};
_newsService.UpdateNewsItem(newsItemViewModel, DateTime.Now);
}
}
}
回答1:
Closing and re-opening VisualStudio is a workaround for this issue.
来源:https://stackoverflow.com/questions/6381196/moles-vs2010-sp1-issue-error-32-exit-code-1002-building-mstest-with-moles-0