public void Add() { var ioc = new ObjectContainer(); ioc.Add(new ObjectMap { ServiceType = typeof(Redis) }); ioc.TryAdd(new ObjectMap { ServiceType = typeof(Redis) }); Assert.Equal(1, ioc.Count); var services = ioc.GetValue("_list") as IList <IObject>; Assert.Equal(1, services.Count); Assert.Equal(typeof(Redis), services[0].ServiceType); Assert.Null(services[0].ImplementationType); Assert.Equal(ObjectLifetime.Singleton, services[0].Lifttime); }
public override void PostBuildUp(IBuilderContext context) { _objectContainer.Add(context.Existing); }