-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit test provider independent ISpecFlowOutputHelper implementation (#…
…2111) * ISpecFlowOutputHelper to write to scenario output independently of used runner plugin * Adapt tests to handle runner specific std out
- Loading branch information
1 parent
7d9f55b
commit cf72078
Showing
8 changed files
with
47 additions
and
47 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
Plugins/TechTalk.SpecFlow.xUnit.SpecFlowPlugin/OutputHelper.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
TechTalk.SpecFlow/Infrastructure/ISpecFlowScenarioOutputListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TechTalk.SpecFlow.Infrastructure | ||
{ | ||
public interface ISpecFlowScenarioOutputListener | ||
{ | ||
void OnMessage(string message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BoDi; | ||
|
||
namespace TechTalk.SpecFlow.Infrastructure | ||
{ | ||
public class SpecFlowOutputHelper : ISpecFlowOutputHelper | ||
{ | ||
private readonly IObjectContainer _container; | ||
|
||
public SpecFlowOutputHelper(IObjectContainer container) | ||
{ | ||
_container = container; | ||
} | ||
|
||
private IEnumerable<ISpecFlowScenarioOutputListener> Listeners => | ||
_container.ResolveAll<ISpecFlowScenarioOutputListener>(); | ||
|
||
public void WriteLine(string message) | ||
{ | ||
Console.WriteLine(message); | ||
foreach (var listener in Listeners) | ||
{ | ||
listener.OnMessage(message); | ||
} | ||
} | ||
|
||
public void WriteLine(string format, params object[] args) | ||
{ | ||
Console.WriteLine(format, args); | ||
WriteLine(string.Format(format, args)); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
TechTalk.SpecFlow/Infrastructure/SpecFlowScenarioOutputTracer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using TechTalk.SpecFlow.Tracing; | ||
|
||
namespace TechTalk.SpecFlow.Infrastructure | ||
{ | ||
public class SpecFlowScenarioOutputTracer : ISpecFlowScenarioOutputListener | ||
{ | ||
private readonly ITraceListener _traceListener; | ||
|
||
public SpecFlowScenarioOutputTracer(ITraceListener traceListener) | ||
{ | ||
_traceListener = traceListener; | ||
} | ||
|
||
public void OnMessage(string message) | ||
{ | ||
_traceListener.WriteTestOutput(message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters