You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to run multiple actions in a unique AppDomainContext.
For example: execute a setup once and in the tests run Actions using previous Setup, sharing test context.
I my case I am writing my tests with Gherkin and it runs multiple steps (methods) to complete a single test.
I take a look in the code and it is simple to add this feature, something like this:
public partial class Smock : IDisposable
{
public AppDomainContext CreateAppDomainContext(Action<ISmocksContext> action, Configuration configuration)
{
IAssemblyRewriter rewriter = CreateAssemblyRewriter(action, configuration);
using (AppDomainContext context = AppDomainContext(rewriter, configuration.Logger))
{
configuration.Logger.Info("Creating service locator for app domain {0}", context);
context.Invoke(new Action(() => ServiceLocator.Instance = CreateServiceLocator(configuration)));
return context;
}
}
public void RunActionInAppDomainContext(Action<ISmocksContext> action, Configuration configuration, AppDomainContext context)
{
configuration.Logger.Info("Invoking action in app domain {0}", context);
context.Invoke(action, _serviceLocator.Resolve<ISmocksContext>());
}
}
The text was updated successfully, but these errors were encountered:
I would like to run multiple actions in a unique AppDomainContext.
For example: execute a setup once and in the tests run Actions using previous Setup, sharing test context.
I my case I am writing my tests with Gherkin and it runs multiple steps (methods) to complete a single test.
I take a look in the code and it is simple to add this feature, something like this:
The text was updated successfully, but these errors were encountered: