-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Steps to reproduce
Create a .Net Framework test project (MSBuild)
Added the following packages:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BoDi" version="1.4.1" targetFramework="net48" />
<package id="Cucumber.Messages" version="6.0.1" targetFramework="net48" />
<package id="Gherkin" version="6.0.0" targetFramework="net48" />
<package id="Google.Protobuf" version="3.7.0" targetFramework="net48" />
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net48" />
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net48" />
<package id="SimpleInjector" version="5.3.0" targetFramework="net48" />
<package id="SpecFlow" version="3.1.80" targetFramework="net48" />
<package id="SpecFlow.MsTest" version="3.1.80" targetFramework="net48" />
<package id="SpecFlow.SimpleInjector" version="2.0.0" targetFramework="net48" />
<package id="SpecFlow.Tools.MsBuild.Generation" version="3.1.80" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net48" />
<package id="System.Reflection.Emit" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.4.0" targetFramework="net48" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net48" />
<package id="Utf8Json" version="1.3.7" targetFramework="net48" />
</packages>Ammended the app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="BoDi" publicKeyToken="ff7cd5ea2744b496" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>Created a simple test feature file and implemented the steps, then created a step implementation where I inject the scenarioContext:
using System;
using TechTalk.SpecFlow;
namespace Example
{
[Binding]
public class ExampleSteps
{
private readonly ScenarioContext scenarioContext;
public PermissiesSteps(ScenarioContext scenarioContext)
{
this.scenarioContext = scenarioContext;
}
[Given(@"some given step")]
public void SomeGivenStep()
{
scenarioContext.Pending();
}
}
}Bound the container in a TestDependencies support class
using SimpleInjector;
using SpecFlow.SimpleInjector;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Example
{
public static class TestDependencies
{
[ScenarioDependencies]
public static Container CreateContainerBuilder()
{
// create empty container
var builder = new Container();
//TODO: add customizations, stubs required for testing
return builder;
}
}
}Metadata
Metadata
Assignees
Labels
No labels