测试方法不确定:未运行测试.错误? [英] Test method is inconclusive: Test wasn't run. Error?

查看:29
本文介绍了测试方法不确定:未运行测试.错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个测试类,下面我发布了测试类中的示例测试

I have a test class and below I have posted a sample test from the test class

namespace AdminPortal.Tests.Controller_Test.Customer
{
    [TestClass]
    public class BusinessUnitControllerTests
    {
        private IBusinessUnitRepository _mockBusinessUnitRepository;
        private BusinessUnitController _controller;

        [TestInitialize]
        public void TestInitialize()
        {
            _mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>();
            _controller = new BusinessUnitController(_mockBusinessUnitRepository);
        }

        [TestCleanup]
        public void TestCleanup()
        {
            _mockBusinessUnitRepository = null;

            _controller.Dispose();
            _controller = null;

        }

        #region Index Action Tests
        [TestMethod]
        public void Index_Action_Calls_GetAllBusinessUnit()
        {
            _mockBusinessUnitRepository.Stub(x => x.GetAllBusinessUnit());

            _controller.Index();

            _mockBusinessUnitRepository.AssertWasCalled(x=>x.GetAllBusinessUnit());
        }
    }
}

当我运行项目时,我得到以下屏幕

When I run the project I get following screen

我检查了参考资料,测试项目有对主项目的参考.知道为什么测试没有运行或说它们是不确定的吗?

I checked the references and the test project has the reference to main project. Any idea why the test are not running or saying that they were inconclusive?

编辑 1:

我在这里看到了一个帖子,并更改了我的测试将默认处理器架构设置为 X64,但它仍然不起作用.

I saw a post here and changed my test's setting's default processor architecture to X64 but it still doesn't work.

推荐答案

这是一个 Resharper 问题.在 Resharper options->Tools->MSTEST 中,我取消选中 Use Legacy Runner,现在它可以工作了.

It was a Resharper issue. In Resharper options->Tools->MSTEST, I unchecked the Use Legacy Runner and now it works.

这篇关于测试方法不确定:未运行测试.错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆