Created
June 4, 2024 14:40
-
-
Save gasparnagy/2023be4a19f7366feedf9b454a28c2d1 to your computer and use it in GitHub Desktop.
Reqnroll debug step-in tester
This file contains hidden or 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
using Moq; | |
using Reqnroll; | |
using Reqnroll.Bindings; | |
using Reqnroll.Bindings.Reflection; | |
using Reqnroll.BoDi; | |
using Reqnroll.Configuration; | |
using Reqnroll.Infrastructure; | |
using Reqnroll.Tracing; | |
// get a sample STATIC method from the package | |
var methodInfo = Type.GetType("ConsoleApp1.SampleClass, ConsoleApp1").GetMethod("SampleMethod"); | |
var bindingInvoker = new BindingInvoker(ConfigurationLoader.GetDefault(), null, new BindingDelegateInvoker()); | |
var binding = new HookBinding(new RuntimeBindingMethod(methodInfo), HookType.BeforeScenario, null, 0); | |
var contextManagerMock = new Mock<IContextManager>(); | |
var scenarioContainer = new ObjectContainer(); | |
scenarioContainer.RegisterInstanceAs(new ScenarioInfo("", null, null, null)); | |
scenarioContainer.RegisterInstanceAs(new Mock<ITestObjectResolver>().Object); | |
contextManagerMock.SetupGet(cm => cm.ScenarioContext) | |
.Returns(scenarioContainer.Resolve<ScenarioContext>()); | |
await bindingInvoker.InvokeBindingAsync(binding, contextManagerMock.Object, Array.Empty<object>(), new Mock<ITestTracer>().Object, new DurationHolder()); | |
Console.WriteLine("Done."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
ConsoleApp1.SampleClass, ConsoleApp1
and theSampleMethod
has to be customized.Line 21 makes the invoke. With a local method debugger steps in correctly.