本文整理匯總了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());
}