public void DefaultBinding_InstanciateMustThrow() { using (var kernel = new StandardKernel()) { kernel.Invoking(x => x.Get<InterceptedTarget>()) .ShouldThrow<InvalidOperationException>(); } }
public void Instanciating_ShouldNotThrow() { using (var kernel = new StandardKernel()) { kernel.Bind<IProxy>().ToProxy(x => x.By(Mock.Of<IDynamicInterceptor>())); kernel.Invoking(x => x.Get<IProxy>()).ShouldNotThrow(); } }
public void Binding_MustThrow() { using (var kernel = new StandardKernel()) { kernel.Invoking(x => x.Bind<INoProxy>().ToProxy(p => { })) .ShouldThrow<InvalidOperationException>() .Where(ex => ex.Message.Contains("[StaticProxy]")); // or maybe we could introduce a custom exception so we don't have to check the message's to make sure it's actually the "right" error case. } }
public void Instanciating_MustThrow() { using (var kernel = new StandardKernel()) { kernel.Bind<IProxy>().ToProxy(x => { }); kernel.Invoking(x => x.Get<IProxy>()) .ShouldThrow<InvalidOperationException>(); } }
public void BoundToSelf_InstanciateMustThrow() { using (var kernel = new StandardKernel()) { kernel.Bind<InterceptedTarget>().ToSelf(); kernel.Invoking(x => x.Get<InterceptedTarget>()) .ShouldThrow<InvalidOperationException>(); } }