本文介绍了Moles/VS2010 SP1问题-错误32,退出代码-1002使用Moles 0.94.51023.0构建mstest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

更新6/20/2011 在收到此错误之前,我只能构建测试项目一次或两次.在此问题解决之前,痣对我来说是无法使用的.删除obj/bin并关闭/重新打开Visual Studio是不切实际的.

Update 6/20/2011I 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.

错误

错误32命令"C:\ Program Files \ Microsoft Moles \ bin \ moles.exe" @C:\ src \ qp \ mvc3 \ Solution \ QP.Tests.Moles \ obj \ Debug \ Moles \ moles. args"退出,代码为-1002. QP.Tests.Moles

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

说明

试图在nunit上使用痣,但遇到了麻烦...所以我用一个测试创建了一个新的mstest项目.建立了测试,我能够调试到SUT中并验证HttpContext包含预期的值.后续构建测试项目的尝试均因上述原因而失败.

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.

注意:我正在运行resharper 6 EAP(我知道,我知道),但是我已禁用了它的mstest运行程序.此外,这是一个构建错误.

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.

我尝试过的事情

尝试在测试项目中重建,清理和删除obj/bin目录.

Have tried rebuild, clean and deleting obj/bin directories in the test project.

代码

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);
        }
    }
}

推荐答案

关闭并重新打开VisualStudio是解决此问题的方法.

Closing and re-opening VisualStudio is a workaround for this issue.

这篇关于Moles/VS2010 SP1问题-错误32,退出代码-1002使用Moles 0.94.51023.0构建mstest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-09 02:41