public void GetServices_BindingDefined_ShouldReturnDefined() { var services = _resolver.GetServices(typeof(Intf1)).ToArray(); Assert.AreEqual(1, services.Length); Assert.IsInstanceOf <Class1>(services[0]); }
public void GetServices_returns_empty_collection_when_none_registered() { var kernel = new StandardKernel(); var resolver = new NinjectDependencyResolver(kernel); var result = resolver.GetServices(typeof(IDateTime)); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); }
private void CreateAutoMapping() { NinjectDependencyResolver resolver = new NinjectDependencyResolver(); var mappers = resolver.GetServices<IMapper>(); foreach (var mapper in mappers) { mapper.Execute(); } }
public void GetServices_returns_multiple_instances_when_some_registered() { var kernel = new StandardKernel(); var resolver = new NinjectDependencyResolver(kernel); kernel.Bind<IDateTime>().To<DateTimeAdapter>(); kernel.Bind<IDateTime>().ToConstant(new Mock<IDateTime>().Object); var result = resolver.GetServices(typeof(IDateTime)); Assert.IsNotNull(result); Assert.AreEqual(2, result.Count()); }
public void GetServices_returns_multiple_instances_when_some_registered() { var kernel = new StandardKernel(); var resolver = new NinjectDependencyResolver(kernel); kernel.Bind <IDateTime>().To <DateTimeAdapter>(); kernel.Bind <IDateTime>().ToConstant(new Mock <IDateTime>().Object); var result = resolver.GetServices(typeof(IDateTime)); Assert.IsNotNull(result); Assert.AreEqual(2, result.Count()); }