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)); }
/// <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); } }
public void Test_EnumAdapter_WithNonEnumType() { string TargetEnumValue = EnumAdapter.GetEnumValue <string>(SourceEnum.VS2005); }
public void Test_EnumAdapter_WithInvalidEnumValue() { TargetEnum TargetEnumValue = EnumAdapter.GetEnumValue <TargetEnum>(SourceEnum.Office2007); }
public void Test_EnumAdapter_WithValidEnumValue() { TargetEnum TargetEnumValue = EnumAdapter.GetEnumValue <TargetEnum>(SourceEnum.VS2005); Assert.AreEqual(TargetEnum.VS2005, TargetEnumValue); }