public void Resolve_SingleNestedDependency_NestedDependencyType()
        {
            var dependencies = new DependencyConfiguration();

            dependencies.RegisterTransient <IService, ServiceImplWithNesting1>();
            dependencies.RegisterTransient <IRepository, RepositoryImpl>();
            var provider = new DependencyProvider(dependencies);
            ServiceImplWithNesting1 service = provider.Resolve <IService>();
            Type expectedType = typeof(RepositoryImpl);
            Type receivedType = service._rep.GetType();

            Assert.AreEqual(expectedType, receivedType, ":-(");
        }
        public void Resolve_SingletonNestedDelendencyForMultipleDependencies_CommonNestedDependencyReference()
        {
            var dependencies = new DependencyConfiguration();

            dependencies.RegisterTransient <IService, ServiceImplWithNesting1>();
            dependencies.RegisterTransient <IService2, ServiceImplWithNesting2>();
            dependencies.RegisterSingleton <IRepository, RepositoryImplSingleton>();
            var provider = new DependencyProvider(dependencies);
            ServiceImplWithNesting1 service1 = provider.Resolve <IService>();
            ServiceImplWithNesting2 service2 = provider.Resolve <IService2>();
            Type service1NestedTypeype       = service1._rep.GetType();
            Type service2NestedTypeype       = service2._rep.GetType();

            Assert.AreEqual(service1NestedTypeype, service2NestedTypeype);
        }
        public void Resolve_UnregistredAbstractionType_ExceptionMessage()
        {
            var    dependencies    = new DependencyConfiguration();
            var    provider        = new DependencyProvider(dependencies);
            string expectedMessage = "Type IService has not been registered.";
            string receivedMessage = "";

            try
            {
                ServiceImplWithNesting1 service = provider.Resolve <IService>();
            }
            catch (UnregisteredAbstractionTypeException e)
            {
                receivedMessage = e.Message;
            }
            Assert.AreEqual(expectedMessage, receivedMessage);
        }