Ejemplo n.º 1
0
        public void CreateInstanceGeneric_WhenAssemblyAdded_InstancesInjectedWithProperties()
        {
            _container.AddAssembly(Assembly.GetExecutingAssembly());

            CustomerBLL_Properties customerBll_properties = _container.CreateInstance <CustomerBLL_Properties>();

            Assert.IsNotNull(customerBll_properties);
            Assert.IsTrue(customerBll_properties.GetType().Equals(typeof(CustomerBLL_Properties)));
            Assert.IsNotNull(customerBll_properties.CustomerDAL);
            Assert.IsTrue(customerBll_properties.CustomerDAL.GetType().Equals(typeof(CustomerDAL)));
            Assert.IsNotNull(customerBll_properties.Logger);
            Assert.IsTrue(customerBll_properties.Logger.GetType().Equals(typeof(Logger)));
        }
Ejemplo n.º 2
0
        public void CreateInstance_WhenTypesAdded_InstancesInjectedWithProperties()
        {
            _container.AddType(typeof(CustomerBLL_Properties));
            _container.AddType(typeof(Logger));
            _container.AddType(typeof(CustomerDAL), typeof(ICustomerDAL));

            CustomerBLL_Properties customerBll_properties = (CustomerBLL_Properties)_container.CreateInstance(typeof(CustomerBLL_Properties));

            Assert.IsNotNull(customerBll_properties);
            Assert.IsTrue(customerBll_properties.GetType().Equals(typeof(CustomerBLL_Properties)));
            Assert.IsNotNull(customerBll_properties.CustomerDAL);
            Assert.IsTrue(customerBll_properties.CustomerDAL.GetType().Equals(typeof(CustomerDAL)));
            Assert.IsNotNull(customerBll_properties.Logger);
            Assert.IsTrue(customerBll_properties.Logger.GetType().Equals(typeof(Logger)));
        }