コード例 #1
0
        public override void Load()
	    {
            Feature feature;
            if (!contentIsCreated)
            {

		        SpecFlowLangParser specFlowLangParser = new SpecFlowLangParser(Language);
                TextReader textReader;
                if (String.IsNullOrEmpty(unparsedFeature))
                {
                    textReader = File.OpenText(SourcePath);
                }
                else
                {
                    textReader = new StringReader(unparsedFeature);
                }
                
                using (textReader)
                {
                    try
                    {
                        feature = specFlowLangParser.Parse(textReader, SourcePath);
                    }
                    catch (SpecFlowParserException ex)
                    {
                        throw new Exception(SourcePath + "\r\n" + ex.Message, ex);
                    }
                }

                if (feature.Tags != null && feature.Tags.Count > 0)
                {
                    Tag userStoryIdTag = feature.Tags.Find(aTag => { return aTag.Name.StartsWith(USER_STORY_ID_TAG_PREFIX); });
                    if (userStoryIdTag != null)
                    {
                        UserStoryId = userStoryIdTag.Name.Substring(USER_STORY_ID_TAG_PREFIX.Length);
                    }
                }

                FeatureTopicContentBuilder builder = new FeatureTopicContentBuilder(feature, Language);

                Name = builder.BuildName();
                Summary = builder.BuildSummary();
                Description = builder.BuildDescription();
                Rules = builder.BuildRules();
                GUI = builder.BuildGUI();
                Notes = builder.BuildNotes();
                Scenarios = builder.BuildBackground();
                Scenarios += builder.BuildScenarios();
                ReferencedImagesPaths = builder.BuildImages(ProjectFolder);

                contentIsCreated = true;
            }
	    }
コード例 #2
0
        static void Main(string[] args)
        {
            string SourcePath = @"G:\_Tools\BlissInSoftware.Sandcastle\BlissInSoftware.Sandcastle.Gherkin\BlissInSoftware.Sandcastle.Gherkin.UnitTests\FeatureWithMultilineTextArgument.feature";
            SpecFlowLangParser specFlowLangParser = new SpecFlowLangParser(new CultureInfo("en-US"));
            TextReader textReader;
            textReader = File.OpenText(SourcePath);
            Feature feature;
            using (textReader)
            {
                try
                {
                    feature = specFlowLangParser.Parse(textReader, SourcePath);
                }
                catch (SpecFlowParserException ex)
                {
                    throw new Exception(SourcePath + "\r\n" + ex.Message, ex);
                }
            }

            FeatureTopicContentBuilder build = new FeatureTopicContentBuilder(feature, new CultureInfo("en-US")); 
            string x = build.BuildDescription();
        }