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

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

问题描述

我有一个测试类及以下我已经发布了抽样检测,从测试类

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:

我看到一个帖子<一个href=\"http://stackoverflow.com/questions/12191352/resharper-7-mstest-not-working-test-wasnt-run\">here并改变了我的测试的设置默认的处理器架构,X64,但它仍然无法正常工作。

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

推荐答案

对于我来说这是相当令人沮丧,但我已经找到解决方案,为我的情况下,至少:

For me it was rather frustrating, but I've found solution for my case at least:

如果您TestMethod的是异步,它不能是无效的。它必须返回任务。

希望它可以帮助别人:)

Hope it helps someone :)

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

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