39195DB1-35BF-4EA9-A926-3522E994D2A0
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
namespace Zenject.Tests.BindFeatures
{
[TestFixture]
public class _TestMultipleContractTypes3 : ZenjectUnitTestFixture
{
class Test0
{ }
class Test3 : Test0
{ }
class Test4 : Test0
{ }
class Test1
{
public Test0 test;
public Test1(Test0 test)
{
this.test = test;
}
}
class Test2
{
public List<Test0> test;
public Test2(List<Test0> test)
{
this.test = test;
}
}
[Test]
public void Test_multibind_mistake()
{
Container.Bind<Test0>()
.To<Test3>()
.AsSingle()
.NonLazy();
Container.Bind<Test0>()
.To<Test4>()
.AsSingle()
.NonLazy();
Container.Bind<Test1>()
.AsSingle()
.NonLazy();
Assert.Throws<ZenjectException>(() => Container.Resolve<Test1>());
}
[Test]
public void Test_mutibind()
{
Container.Bind<Test0>()
.To<Test3>()
.AsSingle()
.NonLazy();
Container.Bind<Test0>()
.To<Test4>()
.AsSingle()
.NonLazy();
Container.Bind<Test2>()
.AsSingle()
.NonLazy();
Assert.DoesNotThrow(() => Container.Resolve<Test2>());
}
}
}