using NUnit.Framework; using Assert = ModestTree.Assert; namespace Zenject.Tests.Bindings { [TestFixture] public class TestNonGeneric : ZenjectUnitTestFixture { [Test] public void Test1() { Assert.Throws(() => Container.Bind(typeof(IFoo), typeof(IBar)).To(typeof(Foo)).AsCached()); } [Test] public void Test2() { Assert.Throws(() => Container.Bind().To(typeof(Bar)).AsCached()); } [Test] public void Test3() { Assert.Throws(() => Container.Bind(typeof(IFoo)).To(typeof(Bar), typeof(Foo)).AsCached()); } [Test] public void Test4() { // This case is more lenient and just ignores invalid bindings Container.Bind(typeof(IFoo), typeof(IBar)).To(typeof(Foo), typeof(Bar)).AsCached(); Assert.IsNotNull(Container.Resolve()); Assert.IsNotNull(Container.Resolve()); } public interface IBar { } public interface IFoo { } public class Bar : IBar { } public class Foo : IFoo { } } }