Ejemplo n.º 1
0
 public void Add <TService, UImpl>(string serviceName, ObjectScope scope) where UImpl : TService
 {
     AddComponentLifeStyle(serviceName, typeof(TService), typeof(UImpl),
                           EnumAdapter.GetEnumValue <LifestyleType>(scope));
     //AddComponentWithLifestyle(serviceName, typeof (TService), typeof (UImpl),
     //                          EnumAdapter.GetEnumValue<LifestyleType>(scope));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Registers this instance.
        /// </summary>
        public void Register(Component component)
        {
            IKernel kernel = Kernel;

            kernel.AddComponent(component.Name, component.Service, component.Impl,
                                EnumAdapter.GetEnumValue <LifestyleType>(component.Scope));


            IHandler handler = kernel.GetHandler(component.Name);

            handler.ComponentModel.LifestyleType = EnumAdapter.GetEnumValue <LifestyleType>(component.Scope);

            kernel.RegisterCustomDependencies(component.Name, component.Parameters);

            foreach (KeyValuePair <string, string> pair in component.References)
            {
                handler.ComponentModel.Parameters.Add(pair.Key, pair.Value);
            }
        }
Ejemplo n.º 3
0
 public void Test_EnumAdapter_WithNonEnumType()
 {
     string TargetEnumValue = EnumAdapter.GetEnumValue <string>(SourceEnum.VS2005);
 }
Ejemplo n.º 4
0
 public void Test_EnumAdapter_WithInvalidEnumValue()
 {
     TargetEnum TargetEnumValue = EnumAdapter.GetEnumValue <TargetEnum>(SourceEnum.Office2007);
 }
Ejemplo n.º 5
0
        public void Test_EnumAdapter_WithValidEnumValue()
        {
            TargetEnum TargetEnumValue = EnumAdapter.GetEnumValue <TargetEnum>(SourceEnum.VS2005);

            Assert.AreEqual(TargetEnum.VS2005, TargetEnumValue);
        }