Beispiel #1
0
        [SetUp] public void SetUp() {
            memory = new TypeDictionary();
            memory.GetItem<Settings>().InputFolder = "in";
            memory.GetItem<Settings>().OutputFolder = "out";

            folders = new FolderTestModel();
        }
        StoryTestFolder CreateStoryTestFolder(Memory memory)
        {
            var storyTestFolder = new StoryTestFolder(memory, new FileSystemModel(memory.GetItem<Settings>().CodePageNumber));

            string tagList = memory.GetItem<Settings>().TagList;
            if (!string.IsNullOrEmpty(tagList))
                storyTestFolder.AddPageFilter(new TagFilter(tagList));

            return storyTestFolder;
        }
Beispiel #3
0
 int Run(Memory memory, IList<string> arguments) {
     ParseArguments(memory, arguments);
     var fileSystem = new FileSystemModel(memory.GetItem<Settings>().CodePageNumber);
     memory.GetItem<Context>().PageSource = fileSystem;
     memory.GetItem<Context>().SuitePath = new DirectoryPath(memory.GetItem<Settings>().InputFolder);
     myRunner = new SuiteRunner(memory, myProgressReporter);
     myRunner.Run(
         CreateStoryTestFolder(memory, fileSystem),
         selectedFile);
     return myRunner.TestCounts.FailCount;
 }
Beispiel #4
0
        StoryTestFolder CreateStoryTestFolder(Memory memory, FolderModel folderModel) {
            var storyTestFolder = new StoryTestFolder(memory, folderModel);

            string tagList = memory.GetItem<Settings>().TagList;
            if (!string.IsNullOrEmpty(tagList))
                storyTestFolder.AddPageFilter(new TagFilter(tagList));

            return storyTestFolder;
        }
Beispiel #5
0
 public int Run(IList<string> commandLineArguments, Memory memory, ProgressReporter reporter) {
     var now = DateTime.Now;
     myProgressReporter = reporter;
     var result = Run(memory, commandLineArguments);
     //todo: to suiterunner?
     if (!memory.GetItem<Settings>().DryRun)
         reporter.Write(string.Format("\n{0}, time: {1}\n", Results, DateTime.Now - now));
     return result;
 }
Beispiel #6
0
        void ParseArguments(Memory memory, IList<string> arguments) {
            if (arguments.Count == 0) {
                return;
            }
            var argumentParser = new ArgumentParser();
            argumentParser.AddSwitchHandler("d", () => memory.GetItem<Settings>().DryRun = true);
            argumentParser.AddArgumentHandler("i", value => memory.GetItem<Settings>().InputFolder = value);
            argumentParser.AddArgumentHandler("o", value => memory.GetItem<Settings>().OutputFolder = value);
            argumentParser.AddArgumentHandler("s", value => selectedFile = value);
            argumentParser.AddArgumentHandler("x", value => memory.GetItem<FileExclusions>().AddRange(value.Split(';')));
            argumentParser.AddArgumentHandler("t", value => memory.GetItem<Settings>().TagList = value);

            argumentParser.Parse(arguments);
            if (memory.GetItem<Settings>().InputFolder == null)
                throw new FormatException("Missing input folder");
            if (memory.GetItem<Settings>().OutputFolder == null)
                throw new FormatException("Missing output folder");
        }
Beispiel #7
0
 public StoryTestFolder(Memory memory, FolderModel theFolderModel)
     : this(memory, 
            memory.GetItem<Settings>().InputFolder,
            memory.GetItem<Settings>().OutputFolder, null, theFolderModel, null) {
     myReport = new Report(OutputPath);
 }