public void DecomposeHeadingCorrectly()
        {
            var expectId      = "REQ01";
            var expectSummary = "requirement";

            var header = CreateBlock($"## [{expectId}]{expectSummary}") as HeaderBlock;

            if (header != null)
            {
                var(actualId, actualSummary) = ParseUtility.DecomposeHeading(header);

                Assert.Equal(expectId, actualId);
                Assert.Equal(expectSummary, actualSummary);
            }
            else
            {
                throw new XunitException("Preparation failed");
            }
        }
Пример #2
0
        private void AnalyzeHeader(MarkdownBlock element, RequirementSpecification data)
        {
            var header = element as HeaderBlock;

            if (header != null)
            {
                var text = header.ToString().Trim();
                switch (header.HeaderLevel)
                {
                case 1:
                    data.Title = text;
                    break;

                case 2:
                {
                    var info = ParseUtility.DecomposeHeading(header);
                    data.Requirements.Add(
                        new UpperRequirement
                        {
                            ID      = info.id,
                            Summary = info.summary
                        }
                        );
                }
                break;

                case 3:
                    if (text.Equals("理由"))
                    {
                        status = UsdmScope.UpperRequiremetReason;
                    }
                    else if (text.Equals("説明"))
                    {
                        status = UsdmScope.UpperRequiremetDescription;
                    }
                    else
                    {
                        var info = ParseUtility.DecomposeHeading(header);
                        data.Requirements.Last().Requirements.Add(
                            new LowerRequirement
                        {
                            ID      = info.id,
                            Summary = info.summary
                        }
                            );
                    }
                    break;

                case 4:
                    if (text.Equals("理由"))
                    {
                        status = UsdmScope.LowerRequiremetReason;
                    }
                    else if (text.Equals("説明"))
                    {
                        status = UsdmScope.LowerRequiremetDescription;
                    }
                    else if (text.Equals("仕様"))
                    {
                        status = UsdmScope.Specification;
                    }
                    break;

                default:
                    Console.WriteLine($"Text: {text}");
                    Console.WriteLine($"Level: {header.HeaderLevel}");
                    Console.WriteLine(element.ToString());
                    status = UsdmScope.None;
                    break;
                }
            }
        }