-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cafb18
commit a5baaf1
Showing
6 changed files
with
154 additions
and
73 deletions.
There are no files selected for viewing
61 changes: 59 additions & 2 deletions
61
Plugins/Reqnroll.SpecFlowCompatibility.ReqnrollPlugin/Wrappers/Table.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 |
---|---|---|
@@ -1,3 +1,60 @@ | ||
// ReSharper disable once CheckNamespace | ||
using System.ComponentModel; | ||
using System.Globalization; | ||
using System; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace TechTalk.SpecFlow; | ||
public class Table(params string[] header) : Reqnroll.Table(header); | ||
|
||
[TypeConverter(typeof(SpecFlowTableConverter))] | ||
public class Table : Reqnroll.Table | ||
{ | ||
public Table(params string[] header) : base(header) | ||
{ | ||
} | ||
|
||
protected internal Table(Reqnroll.Table copyFrom) : base(copyFrom) | ||
{ | ||
} | ||
} | ||
|
||
internal class SpecFlowTableConverter : TypeConverter | ||
{ | ||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) | ||
{ | ||
return typeof(Reqnroll.Table).IsAssignableFrom(sourceType); | ||
} | ||
|
||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) | ||
{ | ||
if (value == null) | ||
return null; | ||
|
||
if (value is Table specFlowTable) | ||
return specFlowTable; | ||
|
||
if (value is Reqnroll.Table tableValue) | ||
{ | ||
return new Table(tableValue); | ||
} | ||
|
||
return base.ConvertFrom(context, culture, value); | ||
} | ||
|
||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) | ||
{ | ||
return destinationType == typeof(Reqnroll.Table); | ||
} | ||
|
||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) | ||
{ | ||
if (destinationType == typeof(Table) || value == null) | ||
return value; | ||
|
||
if (destinationType == typeof(Reqnroll.Table) && value is Table specFlowTable) | ||
{ | ||
return new Reqnroll.Table(specFlowTable); | ||
} | ||
|
||
return base.ConvertTo(context, culture, value, destinationType); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Plugins/Reqnroll.SpecFlowCompatibility.ReqnrollPlugin/Wrappers/TestThreadContext.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,13 @@ | ||
using System; | ||
using BoDi; | ||
using Reqnroll; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace TechTalk.SpecFlow; | ||
|
||
public class TestThreadContext(Reqnroll.TestThreadContext originalContext) : ITestThreadContext | ||
{ | ||
public Exception TestError => originalContext.TestError; | ||
|
||
public IObjectContainer TestThreadContainer => originalContext.TestThreadContainer; | ||
} |
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
Oops, something went wrong.