相关疑难解决方法(0)

如何在Visual Studio 2015上使用NuGet Package Manager安装NUnit for C#?

我有Visual Studio 2015.我想用NuGet Package Manager为C#项目添加NUnit的测试,我希望有可能在VS和VS中运行测试.

  1. 首先我创建新的C#项目:文件 - >新建 - >项目 - >>已安装 - >模板 - > Visual C# - >>控制台应用程序 - >>确定

  2. 然后我安装NUnit:工具 - > NuGet包管理器 - >管理解决方案的NuGet包...然后我安装包:

    • NUnit的
    • NUnit.Runner
    • NUnitTestAdapter

在输出中我看到:

Successfully installed 'NUnit 3.0.0-beta-4' to Tmp.
Successfully installed 'NUnit.Runners 2.6.4' to Tmp.
Successfully installed 'NUnitTestAdapter 2.0.0' to Tmp.
Run Code Online (Sandbox Code Playgroud)
  1. 我要做的下一步是添加带有代码的新类:右键单击项目 - >添加 - >类 - >> Visual C#Items - >类名Tests.cs - >添加

然后我使用下面的代码:

namespace NUnit.Tests
{
    using System;
    using NUnit.Framework;

    [TestFixture]
    public class Tests
    {
        [Test]
        public void t1() …
Run Code Online (Sandbox Code Playgroud)

c# nunit nuget-package visual-studio-2015

11
推荐指数
2
解决办法
2万
查看次数

NUnit无法构建测试 - 未发现任何测试

我正在研究selenium网络驱动程序项目.我能够构建测试Test Explorer并执行.

在重建解决方案时,我立即遇到以下错误.

Unit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
Attempt to load assembly with unsupported test framework in  C:\..\CustomerTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Attempt to load assembly with unsupported test framework in  C:\..\LoginTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\CustomerTest.exe
Cannot …
Run Code Online (Sandbox Code Playgroud)

c# selenium nunit

4
推荐指数
1
解决办法
5503
查看次数

测试方法未在测试资源管理器 VS2013 中显示

我刚开始测试一种计算方法。我对项目进行了清理、重建、x64 调整,并且我有 nunit 测试适配器和其他相关的 dll,但我仍然看不到测试资源管理器窗格中的测试方法。有人可以帮忙吗,是否缺少代码或什么?

namespace Ninja.Tests
{
    [TestFixture]
    public class SinglePricingTests
    {
        [Test]
        public void ShouldCalculate()
        {
            var pricingModelTest = new PricingModel();
            var Sut = new PriceCalculationService(); // Sut: System under test
            var Result = Sut.Calculate(pricingModelTest);
            var TestParameters = new PricingCostParameters();


            Assert.That(Result, Is.EqualTo(TestParameters));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc nunit unit-testing test-explorer

1
推荐指数
1
解决办法
345
查看次数