using NUnit.Framework; using Assert = ModestTree.Assert; namespace Zenject.Tests.Conditions { [TestFixture] public class TestIdentifiers : ZenjectUnitTestFixture { class Test0 { } [Test] public void TestBasic() { Container.Bind().WithId("foo").AsTransient().NonLazy(); Assert.Throws( delegate { Container.Resolve(); }); Container.ResolveId("foo"); } [Test] public void TestBasic2() { Container.Bind().WithId("foo").AsSingle().NonLazy(); Assert.Throws( delegate { Container.Resolve(); }); Container.ResolveId("foo"); } [Test] public void TestBasic3() { Container.Bind().WithId("foo").FromMethod(ctx => new Test0()).NonLazy(); Assert.Throws( delegate { Container.Resolve(); }); Container.ResolveId("foo"); } [Test] public void TestBasic4() { Container.Bind().WithId("foo").AsTransient().NonLazy(); Container.Bind().WithId("foo").AsTransient().NonLazy(); Assert.Throws( delegate { Container.Resolve(); }); Assert.Throws( delegate { Container.ResolveId("foo"); }); Assert.IsEqual(Container.ResolveIdAll("foo").Count, 2); } [Test] public void TestFromMethodUntyped() { Container.Bind(typeof(Test0)).FromMethod(ctx => new Test0()).NonLazy(); Container.Resolve(); } } }