public void ShouldRethrowExceptionIfItHappendInSetterOrPropertyOrInDefaultConstructor() { IObjectProvider provider = new Injectikus.Providers.ClassInstanceProvider(typeof(ClassWithExceptionInSetter)); Assert.That(() => provider.Create(container), Throws.InstanceOf <DivideByZeroException>()); IObjectProvider provider2 = new Injectikus.Providers.ClassInstanceProvider(typeof(ClassWithSetterButWithExceptionInDefaultConstructor)); Assert.That(() => provider2.Create(container), Throws.InstanceOf <DivideByZeroException>()); IObjectProvider provider3 = new Injectikus.Providers.ClassInstanceProvider(typeof(ClassWithExceptionInPropertySetter)); Assert.That(() => provider3.Create(container), Throws.InstanceOf <DivideByZeroException>()); }
public void ShouldRethrowExceptionIfItHappendInInitMethod() { IObjectProvider provider = new Injectikus.Providers.ClassInstanceProvider(typeof(ClassWithExceptionInInitMethod)); Assert.That(() => provider.Create(container), Throws.InstanceOf <DivideByZeroException>()); }