public void CopyFiles()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");


#if NET46
            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
#else
            var baseDirectory = AppContext.BaseDirectory;
#endif

            thePath = baseDirectory.ToFullPath().AppendPath(Guid.NewGuid().ToString());
            var fileSystem = new FileSystem();

            var files = fileSystem.FindFiles(path, FileSet.Deep("*.md"));
            files.Each(file =>
            {
                var relativePath = file.PathRelativeTo(path);
                var destination  = Path.Combine(thePath, relativePath);

                fileSystem.Copy(file, destination);
            });

            theFileWatcher = new NulloSpecFileWatcher();
            Services.Inject <ISpecFileWatcher>(theFileWatcher);

            ClassUnderTest.StartWatching(thePath);
        }
Пример #2
0
        private BatchRunResponse execute(Action <RunInput> configure)
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples");


            var input = new RunInput
            {
                Path = path
            };

            configure(input);

            var controller = input.BuildEngine();
            var task       = controller.Start().ContinueWith(t =>
            {
                var systemRecycled = t.Result;
                if (!systemRecycled.success)
                {
                    systemRecycled.WriteSystemUsage();
                    throw new Exception("Unable to start the system");
                }



                return(input.StartBatch(controller));
            });

            task.Wait();

            task.Result.Wait();

            controller.Dispose();

            return(task.Result.Result);
        }
Пример #3
0
        public void the_spec_type_should_be_header_after_loading_a_spec_as_header()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs", "General", "Check properties.xml");

            var spec = XmlReader.ReadFromFile(path);

            spec.SpecType.ShouldBe(SpecType.header);
        }
        public void can_read_max_retries()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs", "General", "Check properties.md");

            var spec = MarkdownReader.ReadFromFile(path);

            spec.MaxRetries.ShouldBe(3);
        }
Пример #5
0
        public void can_determine_framework_from_project_file_choose_first()
        {
            var input = new OpenInput
            {
                PathFlag = TestingContext.FindParallelDirectory("Samples")
            };

            input.DetermineFramework().ShouldBe("net46");
        }
Пример #6
0
        public SpecExecutionRequestTester()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples")
                       .AppendPath("Specs", "General", "Check properties.xml");

            theSpec = XmlReader.ReadFromFile(path);

            listener = new RuntimeErrorListener();
        }
Пример #7
0
        public void can_determine_framework_from_project_file_chooses_only()
        {
            var input = new OpenInput
            {
                PathFlag = TestingContext.FindParallelDirectory("DatabaseSamples")
            };

            input.DetermineFramework().ShouldBe("netcoreapp1.1");
        }
Пример #8
0
        public void override_framework_with_flag()
        {
            var input = new OpenInput
            {
                FrameworkFlag = "netcoreapp1.1",
                PathFlag      = TestingContext.FindParallelDirectory("Samples")
            };

            input.DetermineFramework().ShouldBe("netcoreapp1.1");
        }
Пример #9
0
        public void pretty_print_for_sample_data()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");


            var hierarchy = HierarchyLoader.ReadHierarchy(path);

            var json = JsonSerialization.ToJson(hierarchy).FormatJson();
            Debug.WriteLine(json);
        }
Пример #10
0
        public void when_there_is_only_one_type()
        {
            // GrammarSystem is the only type in the Samples project

            var path = TestingContext.FindParallelDirectory("Storyteller.Samples");

            var project = Project.LoadForFolder(path);

            var controller = new EngineController(project, new AppDomainSystemLauncher(project));
        }
Пример #11
0
        public void convert_the_top_suite_to_a_hierarchy_gets_the_specs()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");


            var hierarchy = HierarchyLoader.ReadHierarchy(path).ToHierarchy();

            hierarchy.Specifications["embeds"].ShouldNotBeNull();
            hierarchy.Specifications["sentence1"].ShouldNotBeNull();
            hierarchy.Specifications["sentence2"].ShouldNotBeNull();
        }
        private Task <SystemRecycled> start(string projectName)
        {
            _project = new Project
            {
                ProjectPath = TestingContext.FindParallelDirectory(projectName)
            };

            _controller = new EngineController(_project, new ProcessRunnerSystemLauncher(_project));

            return(_controller.Start());
        }
        private RemoteController controllerForProject(string projectFolder)
        {
            var path = TestingContext.FindParallelDirectory(projectFolder);

            var project = Project.LoadForFolder(path);

#if NET46
            return(new RemoteController(project, new AppDomainSystemLauncher(project)));
#else
            return(new RemoteController(project, new ProcessRunnerSystemLauncher(project)));
#endif
        }
Пример #14
0
        public void convert_the_top_suite_to_a_hierarchy_gets_the_suites()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");


            var hierarchy = HierarchyLoader.ReadHierarchy(path).ToHierarchy();

            hierarchy.Suites[string.Empty].ShouldNotBeNull();
            hierarchy.Suites[string.Empty].suites.Count().ShouldBe(6);

            hierarchy.Suites.Select(x => x.path)
                .ShouldHaveTheSameElementsAs("", "Embedded", "General", "Paragraphs", "Sentences", "Sets", "Tables");
        }
        private EngineController controllerForProject(string projectFolder)
        {
            TestUtility.CleanUpHangingProcesses();

            var path = TestingContext.FindParallelDirectory(projectFolder);

            var project = Project.LoadForFolder(path);

#if NET46
            return(new EngineController(project, new AppDomainSystemLauncher(project)));
#else
            return(new EngineController(project, new ProcessRunnerSystemLauncher(project)));
#endif
        }
Пример #16
0
        public void read_a_spec_node()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs", "General", "Check properties.xml");

            var spec = XmlReader.ReadFromFile(path);

            spec.name.ShouldBe("Check properties");
            spec.Lifecycle.ShouldBe(Lifecycle.Acceptance);
            spec.id.ShouldBe("general1"); 
            spec.Filename.ShouldBe(path);

           
            spec.MaxRetries.ShouldBe(3);
        }
Пример #17
0
        public void read_an_entire_suite()
        {
            var path = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");


            var hierarchy = HierarchyLoader.ReadHierarchy(path);

            hierarchy.suites.Select(x => x.name)
                .ShouldHaveTheSameElementsAs("Embedded", "General", "Paragraphs", "Sentences", "Sets", "Tables");

            /*
            var serializer = new Newtonsoft.Json.JsonSerializer();
            var writer = new StringWriter();
            serializer.Serialize(writer, hierarchy);

            var json = writer.ToString();

            Debug.WriteLine(json);
             * */
        }
        public IntegratedHierarchyLoaderFilteringTests()
        {
            var directory = TestingContext.FindParallelDirectory("Storyteller.Samples").AppendPath("Specs");

            theHierarchy = HierarchyLoader.ReadHierarchy(directory);
        }