Moles/VS2010 SP1 Issue - Error 32, exit code -1002 building mstest with Moles 0.94.51023.0

倖福魔咒の 提交于 2019-12-08 08:50:54

问题


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

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