public static CodeItem Create(FileCodeModel2 codeModel) { var list = new List<CodeElement2>(); CollectElements(list, codeModel.CodeElements, new [] { vsCMElement.vsCMElementClass }); if (list.Count == 0) { return new OtherItem("Unknow", null); } var item = list.Cast<CodeClass>().First(); if (item.IsDerivedFrom["MavenThought.Commons.Testing.BaseTest"]) { if (item.Name.Contains("Specification")) { return new SpecificationItem(item.Name, item.Namespace.Name, item.FullName, item.ProjectItem); } var spec = (CodeClass)item.Bases.Cast<CodeElement>().First(ce => ce is CodeClass); var spItem = new SpecificationItem(spec.Name, spec.Namespace.Name, spec.FullName, item.ProjectItem); return new SenarioItem(item.Name, item.Namespace.Name, item.FullName, spItem, item.ProjectItem); } return new ClassItem(item.Name, item.Namespace.Name, item.FullName, item.ProjectItem); }
public static CodeItem Create(FileCodeModel2 codeModel) { var list = new List <CodeElement2>(); CollectElements(list, codeModel.CodeElements, new [] { vsCMElement.vsCMElementClass }); if (list.Count == 0) { return(new OtherItem("Unknow")); } var item = list.Cast <CodeClass>().First(); if (item.IsDerivedFrom["MavenThought.Commons.Testing.BaseTest"]) { if (item.Name.Contains("Specification")) { return(new SpecificationItem(item.Name, item.Namespace.Name, item.FullName)); } var spec = (CodeClass)item.Bases.Cast <CodeElement>().First(ce => ce is CodeClass); var spItem = new SpecificationItem(spec.Name, spec.Namespace.Name, spec.FullName); return(new SenarioItem(item.Name, item.Namespace.Name, item.FullName, spItem)); } return(new ClassItem(item.Name, item.Namespace.Name, item.FullName)); }
public SenarioItem(string name, string codeNamespace, string fullname, SpecificationItem spItem, ProjectItem item) : base(name, codeNamespace, fullname, item) { Specification = spItem; }
/// <summary> /// Open a specification item /// </summary> /// <param name="target"></param> private void Open(SpecificationItem target) { NavigateTo(string.Format("{0}{1}",target.Name.Replace("Specification", ""), Path.GetExtension(target.Item.Name))); }