本文整理汇总了C#中Zenject.DiContainer.ValidateResolve方法的典型用法代码示例。如果您正苦于以下问题:C# DiContainer.ValidateResolve方法的具体用法?C# DiContainer.ValidateResolve怎么用?C# DiContainer.ValidateResolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zenject.DiContainer
的用法示例。
在下文中一共展示了DiContainer.ValidateResolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestBasicFailure
public void TestBasicFailure()
{
var container = new DiContainer();
container.Bind<IFoo>().ToSingle<Foo>();
//container.Bind<Bar>().ToSingle();
Assert.That(!container.ValidateResolve<IFoo>().IsEmpty());
}
示例2: TestList
public void TestList()
{
var container = new DiContainer();
container.Bind<IFoo>().ToSingle<Foo>();
container.Bind<IFoo>().ToSingle<Foo2>();
container.Bind<Bar>().ToSingle();
container.Bind<Qux>().ToSingle();
Assert.That(container.ValidateResolve<Qux>().IsEmpty());
}
示例3: TestValidateNestedContainerList
public void TestValidateNestedContainerList()
{
var container = new DiContainer();
var nestedContainer = new DiContainer(container);
container.Bind<IFoo>().ToSingle<Foo>();
container.Bind<IFoo>().ToSingle<Foo2>();
Assert.That(!container.ValidateResolve<List<IFoo>>().IsEmpty());
Assert.That(!nestedContainer.ValidateResolve<List<IFoo>>().IsEmpty());
container.Bind<Bar>().ToSingle();
Assert.That(container.ValidateResolve<List<IFoo>>().IsEmpty());
// Should not throw
nestedContainer.Resolve<List<IFoo>>();
Assert.That(nestedContainer.ValidateResolve<List<IFoo>>().IsEmpty());
}
示例4: TestParent3
public void TestParent3()
{
var rootContainer = new DiContainer();
rootContainer.Bind<Test0>().ToSingle();
rootContainer.Bind<Test2>().ToSingle();
Assert.Throws<ZenjectResolveException>(() => rootContainer.Resolve<Test2>());
Assert.That(rootContainer.ValidateResolve<Test2>().Any());
}