Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将Nunit2中的EventListener转换为NUnit 3?_C#_Nunit 3.0 - Fatal编程技术网

C# 如何将Nunit2中的EventListener转换为NUnit 3?

C# 如何将Nunit2中的EventListener转换为NUnit 3?,c#,nunit-3.0,C#,Nunit 3.0,我想向NUnit添加一个自定义测试报告程序。我已经用NUnit2做了,但是现在我需要用NUnit3。我的解决方案中有两个项目 1.记者项目 2.测试项目 在测试项目中,我有一个nunithook文件,它连接到包含nunitregistar的reporter项目 这样我就可以“聆听”nunit框架事件。 我已经更新到nunit 3.8.1,我看到一切都改变了,这个解决方案不再有效 这是两个文件的实现: using Reporter.Nunit; using NUnit.Core.Extensibi

我想向NUnit添加一个自定义测试报告程序。我已经用NUnit2做了,但是现在我需要用NUnit3。我的解决方案中有两个项目 1.记者项目 2.测试项目

在测试项目中,我有一个nunithook文件,它连接到包含nunitregistar的reporter项目

这样我就可以“聆听”nunit框架事件。 我已经更新到nunit 3.8.1,我看到一切都改变了,这个解决方案不再有效

这是两个文件的实现:

using Reporter.Nunit;
using NUnit.Core.Extensibility;

namespace NunitHook
{
    [NUnitAddin(Name= "NUnitHook", Description = "NUnit Hook")]
    public class NUnitHook : NunitRegistrar
    {

    }
}

using System;
using System.IO;
using System.Linq;
using NUnit.Core.Extensibility;

namespace Reporter.Nunit
{
    [NUnitAddin(Name = "EventListnerForReport", Description = "Event listener that listens to the tests and dispatches the events to the report manager")]
    public class NunitRegistrar : IAddin
    {
        private bool registeredListeners;

        public bool Install(IExtensionHost host)
        {
            if (!registeredListeners)
            {
                if (host == null)
                {
                    throw new ArgumentNullException("host");
                }

                IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
                if (listeners == null)
                {
                    return false;
                }

                listeners.Install(new TestEventListener());
                registeredListeners = true;

                return true;
            }

            return true;
        }
    }
}
有没有一个简单的方法将其转换为nunit 3

谢谢