Update Project

This commit is contained in:
2026-03-20 13:04:43 +02:00
parent 9b587e6cba
commit beae2dea89
2295 changed files with 251259 additions and 33 deletions
@@ -0,0 +1,40 @@
using System.Linq;
using NUnit.Framework;
using Assert = ModestTree.Assert;
namespace Zenject.Tests.Conditions
{
[TestFixture]
public class TestConditionsComplex : ZenjectUnitTestFixture
{
class Foo
{
}
class Bar
{
public Foo Foo;
public Bar(Foo foo)
{
Foo = foo;
}
}
[Test]
public void TestCorrespondingIdentifiers()
{
var foo1 = new Foo();
var foo2 = new Foo();
Container.Bind<Bar>().WithId("Bar1").AsTransient().NonLazy();
Container.Bind<Bar>().WithId("Bar2").AsTransient().NonLazy();
Container.BindInstance(foo1).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && Equals(x.Identifier, "Bar1")).Any());
Container.BindInstance(foo2).When(c => c.ParentContexts.Where(x => x.MemberType == typeof(Bar) && Equals(x.Identifier, "Bar2")).Any());
Assert.IsEqual(Container.ResolveId<Bar>("Bar1").Foo, foo1);
Assert.IsEqual(Container.ResolveId<Bar>("Bar2").Foo, foo2);
}
}
}