本文整理汇总了C#中Ninject.StandardKernel.Invoking方法的典型用法代码示例。如果您正苦于以下问题:C# StandardKernel.Invoking方法的具体用法?C# StandardKernel.Invoking怎么用?C# StandardKernel.Invoking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ninject.StandardKernel
的用法示例。
在下文中一共展示了StandardKernel.Invoking方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultBinding_InstanciateMustThrow
public void DefaultBinding_InstanciateMustThrow()
{
using (var kernel = new StandardKernel())
{
kernel.Invoking(x => x.Get<InterceptedTarget>())
.ShouldThrow<InvalidOperationException>();
}
}
开发者ID:BrunoJuchli,项目名称:ninject.extensions.staticproxy,代码行数:8,代码来源:When_class_is_not_bound_correctly.cs
示例2: Instanciating_ShouldNotThrow
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();
}
}
示例3: Binding_MustThrow
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.
}
}
开发者ID:BrunoJuchli,项目名称:ninject.extensions.staticproxy,代码行数:9,代码来源:When_there_is_no_proxy_implementation_for_interface.cs
示例4: Instanciating_MustThrow
public void Instanciating_MustThrow()
{
using (var kernel = new StandardKernel())
{
kernel.Bind<IProxy>().ToProxy(x => { });
kernel.Invoking(x => x.Get<IProxy>())
.ShouldThrow<InvalidOperationException>();
}
}
示例5: BoundToSelf_InstanciateMustThrow
public void BoundToSelf_InstanciateMustThrow()
{
using (var kernel = new StandardKernel())
{
kernel.Bind<InterceptedTarget>().ToSelf();
kernel.Invoking(x => x.Get<InterceptedTarget>())
.ShouldThrow<InvalidOperationException>();
}
}
开发者ID:BrunoJuchli,项目名称:ninject.extensions.staticproxy,代码行数:10,代码来源:When_class_is_not_bound_correctly.cs