Example #1
0
        public void GetNewInstanceOfInterface_WhenImplementationTakesArrayOfGenericDependencies_ReturnsInstanceContainingAllMappedDependencies()
        {
            IGenericTestService genericTestService = Container.GetNewInstance <IGenericTestService>();

            Assert.IsTrue(genericTestService is MyGenericService);

            var resolvedDependencies = genericTestService.GetDependencies();

            Assert.AreEqual(2, resolvedDependencies.Length);

            Assert.IsNotNull(resolvedDependencies.SingleOrDefault(x => x.GetType() == typeof(GenericDependencyOne)), $"Expected one dependency of type {nameof(GenericDependencyOne)}");
            Assert.IsNotNull(resolvedDependencies.SingleOrDefault(x => x.GetType() == typeof(GenericDependencyTwo)), $"Expected one dependency of type {nameof(GenericDependencyTwo)}");
        }
 public TestController(ITestService testService, IGenericTestService <int> genericTestService)
 {
     this.testService        = testService;
     this.genericTestService = genericTestService;
 }