A lightweight IOC Container that is powerful enough to do all the things you need it to do.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
999 B

// // 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<ITest> testRegistration = RegistrationFactory.Register<ITest, Test>().OnCreate(t => t.DoSomething());
ITest test = new Test();
Assert.Throws<Exception>(() => testRegistration.OnCreateAction(test));
}
}
}