public void RoundTrip(Type type) { // We want to assert that InsTypeFactory.ParseTypeName should be able to handle whatever Type.AssemblyQualifiedName produces and // InsFormatter.Format should produce something that Type.GetType can understand, but we don't want to tie ourselves to any // particular assembly name or qualifications that a given target framework uses. We could also assert that we format the type // name in the same way as AssemblyQualifiedName, but then we run the risk of breaking if different frameworks format it // differently. var insType = InsTypeFactory.ParseTypeName(type.AssemblyQualifiedName !); var resultType = Type.GetType(InsFormatter.Format(insType)); Assert.That(resultType, Is.EqualTo(type)); }
public override string ToString() => InsFormatter.Format(this);
public string WithoutQualification(string assemblyName, string name) { return(InsFormatter.Format( InsTypeFactory.ParseAssemblyName(assemblyName) .WithoutQualification(name))); }
public string TryGetProcessorArchitecture(string assemblyName, ProcessorArchitecture processorArchitecture) { return(InsFormatter.Format( InsTypeFactory.ParseAssemblyName(assemblyName) .WithProcessorArchitecture(processorArchitecture))); }
public string WithPublicKey(string assemblyName, byte[] publicKey) { return(InsFormatter.Format( InsTypeFactory.ParseAssemblyName(assemblyName) .WithPublicKey(publicKey))); }
public string WithVersion(string assemblyName, string version) { return(InsFormatter.Format( InsTypeFactory.ParseAssemblyName(assemblyName) .WithVersion(Version.Parse(version)))); }