diff --git a/LightweightIocContainer/ActionExtension.cs b/LightweightIocContainer/ActionExtension.cs
new file mode 100644
index 0000000..cfc9d88
--- /dev/null
+++ b/LightweightIocContainer/ActionExtension.cs
@@ -0,0 +1,26 @@
+// Author: Gockner, Simon
+// Created: 2019-12-11
+// Copyright(c) 2019 SimonG. All Rights Reserved.
+
+using System;
+
+namespace LightweightIocContainer
+{
+ internal static class ActionExtension
+ {
+ ///
+ /// Convert an to an of an inherited
+ ///
+ /// The of the to convert to, has to be implemented by
+ /// The of the given , has to implement
+ /// The given to convert
+ /// An converted from the given
+ public static Action Convert(this Action action) where T1 : T2
+ {
+ if (action == null)
+ return null;
+
+ return t => action(t);
+ }
+ }
+}
\ No newline at end of file
diff --git a/LightweightIocContainer/LightweightIocContainer.xml b/LightweightIocContainer/LightweightIocContainer.xml
index c200464..4f6412f 100644
--- a/LightweightIocContainer/LightweightIocContainer.xml
+++ b/LightweightIocContainer/LightweightIocContainer.xml
@@ -4,6 +4,15 @@
LightweightIocContainer
+
+
+ Convert an to an of an inherited
+
+ The of the to convert to, has to be implemented by
+ The of the given , has to implement
+ The given to convert
+ An converted from the given
+
Returns the first element of a , or a new instance of a given if the contains no elements
@@ -418,6 +427,55 @@
The current
+
+
+ Provides an method to an
+
+ The registered interface
+
+
+
+ This is invoked when an instance of this type is created.
+ Can be set in the by calling
+
+
+
+
+ Pass an that will be invoked when an instance of this type is created
+
+ The
+ The current instance of this
+
+
+
+ Provides a method to an
+
+ The registered interface
+
+
+
+ An of parameters that are used to an instance of this
+ Can be set in the by calling
+
+
+
+
+ Pass parameters that will be used to an instance of this
+ Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving
+
+ The parameters
+ The current instance of this
+ are already set or no parameters given
+
+
+
+ Pass parameters that will be used to an instance of this
+ Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving
+
+ The parameters with their position
+ The current instance of this
+ are already set or no parameters given
+
The to register a for the Interface it implements
@@ -466,43 +524,6 @@
The Lifestyle of Instances that are created with this
-
-
- This is invoked when an instance of this type is created.
- Can be set in the by calling
-
-
-
-
- Pass an that will be invoked when an instance of this type is created
-
- The
- The current instance of this
-
-
-
- An of parameters that are used to an instance of this
- Can be set in the by calling
-
-
-
-
- Pass parameters that will be used to an instance of this
- Parameters set with this method are always inserted at the beginning of the argument list if more parameters are given when resolving
-
- The parameters
- The current instance of this
- are already set or no parameters given
-
-
-
- Pass parameters that will be used to an instance of this
- Parameters set with this method are inserted at the position in the argument list that is passed with the parameter if more parameters are given when resolving
-
- The parameters with their position
- The current instance of this
- are already set or no parameters given
-
The to register either only an interface or only a
@@ -683,12 +704,12 @@
- Update the given arguments with the of the given
+ Update the given arguments with the of the given
The given
The of the given
The constructor arguments
- The argument list updated with the
+ The argument list updated with the
diff --git a/Test.LightweightIocContainer/ActionExtensionTest.cs b/Test.LightweightIocContainer/ActionExtensionTest.cs
new file mode 100644
index 0000000..3ebce77
--- /dev/null
+++ b/Test.LightweightIocContainer/ActionExtensionTest.cs
@@ -0,0 +1,52 @@
+// Author: Gockner, Simon
+// Created: 2019-12-11
+// Copyright(c) 2019 SimonG. All Rights Reserved.
+
+using System;
+using LightweightIocContainer;
+using NUnit.Framework;
+
+namespace Test.LightweightIocContainer
+{
+ [TestFixture]
+ public class ActionExtensionTest
+ {
+ #region TestClasses
+
+ private interface IBar
+ {
+ void Throw();
+ }
+
+ private interface IFoo : IBar
+ {
+
+ }
+
+ private class Foo : IFoo
+ {
+ public void Throw()
+ {
+ throw new Exception();
+ }
+ }
+
+ #endregion TestClasses
+
+ [Test]
+ public void TestConvert()
+ {
+ Action barAction = bar => bar.Throw();
+ Action action = barAction.Convert();
+
+ Assert.Throws(() => action(new Foo()));
+ }
+
+ [Test]
+ public void TestConvertActionNull()
+ {
+ Action barAction = null;
+ Assert.Null(barAction.Convert());
+ }
+ }
+}
\ No newline at end of file