Example #1
0
        static void PrintFolder(FeatureFolderViewModel f, string pathSoFar, int indent)
        {
            var prefix = new string(' ', indent * 2);
            //var prefix = string.Concat(Enumerable.Repeat("    ", indent));

            var name = (pathSoFar + "/" + f.Name).TrimStart('/');
            var status = f.DescendantFeatures().Select(x=>x.Status).DefaultIfEmpty(Status.Unknown).Max();
            WriteLine(status, "");
            if (!string.IsNullOrWhiteSpace(name))
            {
                WriteLine(status, new string('_', name.Length + 1));
                WriteLine(status, name + ":");
                WriteLine(status, new string('¯', name.Length + 1));
            }

            foreach (var feature in f.Features)
            {
                WriteLine(feature.Status, prefix + "Feature: {0}", feature.Name);
                foreach (var scenario in feature.Scenarios)
                {
                    WriteLine(scenario.Status, prefix + "  Scenario: {0}", scenario.ScenarioNode.Title);
                }
            }

            foreach (var c in f.SubFolders)
            {
                PrintFolder(c, name, indent + 1);
            }
        }
Example #2
0
        public FeatureFolderViewModel SubFolder(string path, bool createIfNotExists = false)
        {
            if (string.IsNullOrEmpty(path))
            {
                return this;
            }

            var split = path.Split("/".ToCharArray(), 2);
            var folder = SubFolders.SingleOrDefault(x => x.Name == split[0]);

            if (folder != null)
            {
                return folder.SubFolder(split.ElementAtOrDefault(1), createIfNotExists);
            }
            if (createIfNotExists)
            {
                var newFolder = new FeatureFolderViewModel(split[0]);
                SubFolders.Add(newFolder);
                return newFolder.SubFolder(split.ElementAtOrDefault(1), createIfNotExists);
            }

            throw new Exception(string.Format("Folder not found {0} in {1}", path, Name));
        }
Example #3
0
 public RootViewModel()
 {
     RootFolder = new FeatureFolderViewModel("");
 }