From f9b4b4f5eabdbf78eff44c70acaebd9b6103b364 Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Thu, 6 Jun 2019 16:34:14 +0200 Subject: [PATCH] - add defaultRegistration test --- .../DefaultRegistrationTest.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Test.LightweightIocContainer/DefaultRegistrationTest.cs 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