示例#1
0
        public string GenerateFeatureFileContent(int scenarioCount, int scenarioOutlineCount = 0, string featureTitle = null)
        {
            var content = new StringBuilder();

            content.AppendLine($"Feature: {featureTitle ?? ToTitle(LoremIpsum.GetShortText())}");
            content.AppendLine();
            content.AppendLine(LoremIpsum.GetShortText());
            content.AppendLine(LoremIpsum.GetShortText());
            content.AppendLine();

            var scenarioDefs = LoremIpsum.Randomize(
                Enumerable.Range(0, scenarioCount).Select(i => "S")
                .Concat(Enumerable.Range(0, scenarioOutlineCount).Select(i => "O")));

            for (int i = 0; i < scenarioDefs.Length; i++)
            {
                if (scenarioDefs[i] == "S")
                {
                    GenerateScenario(content);
                }
                else
                {
                    GenerateScenarioOutline(content);
                }
            }

            return(content.ToString());
        }
示例#2
0
        public List <string> GenerateStepDefClasses(string targetFolder, int stepDefPerClassCount)
        {
            var sdList     = LoremIpsum.Randomize(stepDefinitions.SelectMany(g => g.Value));
            int startIndex = 0;
            var result     = new List <string>();

            result.Add(Path.Combine(targetFolder, "..", "AutomationStub.cs"));

            while (startIndex < sdList.Length)
            {
                result.Add(
                    GenerateStepDefClass(targetFolder,
                                         sdList.Skip(startIndex).Take(Math.Min(stepDefPerClassCount, sdList.Length - startIndex))));
                startIndex += stepDefPerClassCount;
            }

            return(result);
        }