コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public SenarioItem(string name, string codeNamespace, string fullname, SpecificationItem spItem, ProjectItem item)
     : base(name, codeNamespace, fullname, item)
 {
     Specification = spItem;
 }
コード例 #4
0
 /// <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)));
 }        
コード例 #5
0
 public SenarioItem(string name, string codeNamespace, string fullname, SpecificationItem spItem, ProjectItem item)
     : base(name, codeNamespace, fullname, item)
 {
     Specification = spItem;
 }