public void AssemblyQualifiedTypeNameContainsAssemblyPart() { var tn = TypeFullName.Parse("System.String, mscorlib"); Assert.AreEqual("System.String", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); }
public void EmptyStringIsNotAValidTypeName() { Assert_Throws <ArgumentException>(() => TypeFullName.Parse(null)); Assert_Throws <ArgumentException>(() => TypeFullName.Parse(string.Empty)); Assert_Throws <ArgumentException>(() => TypeFullName.Parse(" ")); Assert_Throws <ArgumentException>(() => TypeFullName.Parse(" \t\r\n ")); }
public void AssemblyQualifiedTypeNameContainsAssemblyAndVersionParts() { var tn = TypeFullName.Parse(typeof(string).AssemblyQualifiedName); Assert.AreEqual("System.String", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); tn = TypeFullName.Parse("System.Management.Automation.PSObject, System.Management.Automation, Version=3.0.0.0"); Assert.AreEqual("System.Management.Automation.PSObject", tn.TypeName); Assert.AreEqual("System.Management.Automation", tn.AssemblyName); }
private void CreateFields() { string typeName = TypeFullName.Parse(ModelSelectedTemplate); TemplateConfiguration templateConfig = TemplateConfiguration.GetConfiguration(GetService <DTE>(true)); foreach (ModelProvider modelProvider in templateConfig.ModelProviders) { Assembly modelAssembly = Assembly.LoadFrom(modelProvider.ProviderAssemblyLocation); Type modelType = modelAssembly.GetType(typeName); if (modelType != null) { TraslateFields(modelType); break; } } }
public void SimpleTypeNameDoesntHaveAssemblyAndVersionParts() { var tn = TypeFullName.Parse("string"); Assert.AreEqual("string", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); tn = TypeFullName.Parse("System.String"); Assert.AreEqual("System.String", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); tn = TypeFullName.Parse("System.Management.Automation.PSObject"); Assert.AreEqual("System.Management.Automation.PSObject", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); tn = TypeFullName.Parse(typeof(Enumerable).FullName); Assert.AreEqual("System.Linq.Enumerable", tn.TypeName); Assert.AreEqual("mscorlib", tn.AssemblyName); }
private static string FormatTemplate(IEnumerable <string> objectValues) { var formattedObject = string.Empty; foreach (string item in objectValues) { string formattedItemName = TypeFullName.Parse(item); if (formattedItemName.StartsWith(".")) { formattedItemName = formattedItemName.Remove(0, 1); } if (formattedObject == string.Empty) { formattedObject = "'" + formattedItemName + "'"; } else { formattedObject = formattedObject + ",\r\n\t\t'" + formattedItemName + "'"; } } return(formattedObject); }
private void CreateModelName() { StoreSelectedModel = TypeFullName.Parse(StoreSelectedTemplate); }