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); }
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); }
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; }
public void ConvertToPartialAssemblyName_WhenTheAssemblyNameIsPartial_ReturnsTheSameInstance() { TypeName typeName = new TypeName("Type", new AssemblyName("PartialName")); Assert.AreSame(typeName, typeName.ConvertToPartialAssemblyName()); }