Exemplo n.º 1
0
        public static object FindByName(NamedServiceContainer container, string name)
        {
            if (container == null)
                throw new ArgumentNullException("container");

            return container.Get(name);
        }
 public void GetByName()
 {
     NamedServiceContainer container = new NamedServiceContainer();
     object service = new object();
     container.Add("test", service);
     Assert.AreSame(service, ServiceQuery.GetByName(container, "test"));
 }
Exemplo n.º 3
0
        public static object GetByName(NamedServiceContainer container, string name)
        {
            object service = FindByName(container, name);

            if (service == null)
                ServiceNotAvailableException.ThrowFormatted(name);

            return service;
        }
 public void Init()
 {
     _container = new NamedServiceContainer();
 }
 public object Create(NamedServiceContainer container, string name)
 {
     Called = true;
     CallContainer = container;
     CallName = name;
     return new object();
 }
 public void GetUnavailableByName()
 {
     NamedServiceContainer container = new NamedServiceContainer();
     ServiceQuery.GetByName(container, "Unknown");
 }
 public void FindUnavailableByName()
 {
     NamedServiceContainer container = new NamedServiceContainer();
     Assert.IsNull(ServiceQuery.FindByName(container, "Unknown"));
 }