diff --git a/Test.LightweightIocContainer/DefaultRegistrationTest.cs b/Test.LightweightIocContainer/DefaultRegistrationTest.cs new file mode 100644 index 0000000..afd47a3 --- /dev/null +++ b/Test.LightweightIocContainer/DefaultRegistrationTest.cs @@ -0,0 +1,43 @@ +// // Author: Gockner, Simon +// // Created: 2019-06-06 +// // Copyright(c) 2019 SimonG. All Rights Reserved. + +using System; +using LightweightIocContainer.Interfaces.Registrations; +using LightweightIocContainer.Registrations; +using NUnit.Framework; + +namespace Test.LightweightIocContainer +{ + [TestFixture] + public class DefaultRegistrationTest + { + #region TestClasses + + private interface ITest + { + void DoSomething(); + } + + private class Test : ITest + { + public void DoSomething() + { + throw new Exception(); + } + } + + #endregion + + + [Test] + public void TestOnCreate() + { + IDefaultRegistration testRegistration = RegistrationFactory.Register().OnCreate(t => t.DoSomething()); + + ITest test = new Test(); + + Assert.Throws(() => testRegistration.OnCreateAction(test)); + } + } +} \ No newline at end of file