public void Setup()
        {
            var rootPath = FileSystem.DirectoryInfo.FromDirectoryName(FileSystemPrefix);

            this.AddFakeFolderStructures();

            Tree features = Container.Resolve <DirectoryTreeCrawler>().Crawl(rootPath, new ParsingReport());

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectory);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder        = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectory),
                DocumentationFormat = DocumentationFormat.Json
            };

            var jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, null, FileSystem, new LanguageServicesRegistry());

            jsonDocumentationBuilder.Build(features);
        }
        public string Setup()
        {
            const string OutputDirectoryName = FileSystemPrefix + @"JSONFeatureOutput";
            var          rootPath            = FileSystem.DirectoryInfo.FromDirectoryName(FileSystemPrefix + @"JSON\Features");

            const string TestResultFilePath = FileSystemPrefix + @"JSON\results-example-failing-and-pasing-mstest.trx";

            string filePath = FileSystem.Path.Combine(OutputDirectoryName, JsonDocumentationBuilder.JsonFileName);

            this.AddFakeFolderAndFiles("JSON", new[] { "results-example-failing-and-pasing-mstest.trx" });
            this.AddFakeFolderAndFiles(
                @"JSON\Features",
                new[]
            {
                "OneScenarioTransferingMoneyBetweenAccountsFailing.feature",
                "TransferBetweenAccounts_WithSuccess.feature",
                "TwoScenariosTransferingFundsOneFailingOneSuccess.feature",
                "TwoScenariosTransferingMoneyBetweenAccoutsWithSuccess.feature",
            });

            var resultFile = RetrieveContentOfFileFromResources(ResourcePrefix + "JSON.results-example-failing-and-pasing-mstest.trx");

            FileSystem.AddFile(TestResultFilePath, resultFile);

            Tree features = Container.Resolve <DirectoryTreeCrawler>().Crawl(rootPath, new ParsingReport());

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder           = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectoryName),
                DocumentationFormat    = DocumentationFormat.Json,
                TestResultsFormat      = TestResultsFormat.MsTest,
                SystemUnderTestName    = "SUT Name",
                SystemUnderTestVersion = "SUT Version"
            };

            configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName(TestResultFilePath));

            ITestResults testResults = new MsTestResults(configuration, new MsTestSingleResultLoader(), new MsTestScenarioOutlineExampleMatcher());
            var          jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, testResults, FileSystem, new LanguageServicesRegistry());

            jsonDocumentationBuilder.Build(features);
            string content = FileSystem.File.ReadAllText(filePath);

            return(content);
        }
        public void Setup()
        {
            this.AddFakeFolderStructures();

            Tree features = Container.Resolve <DirectoryTreeCrawler>().Crawl(FileSystemPrefix);

            var outputDirectory = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectory);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var configuration = new Configuration
            {
                OutputFolder        = FileSystem.DirectoryInfo.FromDirectoryName(OutputDirectory),
                DocumentationFormat = DocumentationFormat.Json
            };

            var jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, null, FileSystem);

            jsonDocumentationBuilder.Build(features);
        }
コード例 #4
0
        private void UtilizeJsonBuilderToDumpJsonFeatureFileNextToDthmlResources(Tree features)
        {
            var jsonBuilder = new JsonDocumentationBuilder(this.configuration, this.testResults, this.fileSystem);

            jsonBuilder.Build(features);
        }