c# - How to covert EventListener in Nunit2 to NUnit 3? -
i want add custom test reporter nunit. did nunit2, need use nunit3. have 2 projects in solution 1. reporter project 2. tests project
in test project have nunithook file hooked reporter project contains nunitregistrar.
that way can "listen" nunit framework events. i've updated nunit 3.8.1 , see has changed , soultion doesn't work anymore.
this implementation both files:
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 listens tests , dispatches events 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; } } }
is there easy way convert nunit 3?
thanks !
Comments
Post a Comment