示例#1
0
        public void ConvertToPartialAssemblyName_WhenTheAssemblyNameIsFull_ReturnsANewInstanceWithThePartialName()
        {
            TypeName typeName = new TypeName("Type", new AssemblyName("FullName, Version=1.2.3.4"));

            TypeName result = typeName.ConvertToPartialAssemblyName();

            Assert.IsTrue(result.HasPartialAssemblyName);
            Assert.AreEqual("Type, FullName", result.AssemblyQualifiedName);
        }
示例#2
0
        public ServiceDescriptor GetServiceByServiceTypeName(TypeName serviceTypeName)
        {
            ServiceDescriptor service;

            if (servicesByServiceTypeName.TryGetValue(serviceTypeName, out service))
            {
                return(service);
            }

            if (!serviceTypeName.HasPartialAssemblyName)
            {
                serviceTypeName = serviceTypeName.ConvertToPartialAssemblyName();
                if (servicesByServiceTypeName.TryGetValue(serviceTypeName, out service))
                {
                    return(service);
                }
            }

            return(null);
        }
示例#3
0
        public ServiceDescriptor GetServiceByServiceTypeName(TypeName serviceTypeName)
        {
            ServiceDescriptor service;
            if (servicesByServiceTypeName.TryGetValue(serviceTypeName, out service))
                return service;

            if (! serviceTypeName.HasPartialAssemblyName)
            {
                serviceTypeName = serviceTypeName.ConvertToPartialAssemblyName();
                if (servicesByServiceTypeName.TryGetValue(serviceTypeName, out service))
                    return service;
            }

            return null;
        }
示例#4
0
        public void ConvertToPartialAssemblyName_WhenTheAssemblyNameIsPartial_ReturnsTheSameInstance()
        {
            TypeName typeName = new TypeName("Type", new AssemblyName("PartialName"));

            Assert.AreSame(typeName, typeName.ConvertToPartialAssemblyName());
        }