Exemplo n.º 1
0
        public void AssemblyQualifiedTypeNameContainsAssemblyPart()
        {
            var tn = TypeFullName.Parse("System.String, mscorlib");

            Assert.AreEqual("System.String", tn.TypeName);
            Assert.AreEqual("mscorlib", tn.AssemblyName);
        }
Exemplo n.º 2
0
 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  "));
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
                }
            }
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 private void CreateModelName()
 {
     StoreSelectedModel = TypeFullName.Parse(StoreSelectedTemplate);
 }