diff --git a/Examples/ByFeature/FunctionalInjection/FunctionalInjection.fsproj b/Examples/ByFeature/FunctionalInjection/FunctionalInjection.fsproj
index 7623056..170a9f5 100644
--- a/Examples/ByFeature/FunctionalInjection/FunctionalInjection.fsproj
+++ b/Examples/ByFeature/FunctionalInjection/FunctionalInjection.fsproj
@@ -5,6 +5,7 @@
net6.0;net452
+
diff --git a/Examples/ByFeature/FunctionalInjection/Logger.fs b/Examples/ByFeature/FunctionalInjection/Logger.fs
new file mode 100644
index 0000000..8c9232e
--- /dev/null
+++ b/Examples/ByFeature/FunctionalInjection/Logger.fs
@@ -0,0 +1,23 @@
+module Logger
+
+open TickSpec
+open System
+
+type LogMessages = string list
+
+type LoggerContext = { Messages: LogMessages }
+
+let [] setup () =
+ { Messages = "Before scenario" |> List.singleton }
+
+let [] beforeStep (previousMessages: LoggerContext) =
+ { Messages = "Before step" :: previousMessages.Messages }
+
+let [] afterStep (previousMessages: LoggerContext) =
+ { Messages = "After step" :: previousMessages.Messages }
+
+let [] afterScenario (previousMessages: LoggerContext) =
+ let allMessages =
+ "After scenario" :: previousMessages.Messages
+ |> List.rev
+ allMessages |> List.iter Console.WriteLine
diff --git a/TickSpec/ScenarioGen.fs b/TickSpec/ScenarioGen.fs
index 13660f5..a3a154c 100644
--- a/TickSpec/ScenarioGen.fs
+++ b/TickSpec/ScenarioGen.fs
@@ -334,6 +334,38 @@ let emitArgument
else
emitValue gen providerField parsers paramType arg
+/// Emit arguments through injection
+let emitInjectionArguments
+ (gen:ILGenerator)
+ (providerField:FieldBuilder)
+ (parameters: ParameterInfo array) =
+ parameters
+ |> Array.iter (fun p -> emitInstance gen providerField p.ParameterType)
+
+let storeMethodResultInProvider
+ (gen:ILGenerator)
+ (providerField:FieldBuilder)
+ (mi:MethodInfo) =
+ if mi.ReturnType <> typeof then
+ gen.Emit(OpCodes.Box,mi.ReturnType)
+ let local0 = gen.DeclareLocal(typeof