Exemplo n.º 1
0
 internal Section(Element element, SectionType type, DocumentationFormat format, string content)
 {
     this.Element = element;
     this.Type    = type;
     this.Format  = format;
     this.Content = content;
 }
Exemplo n.º 2
0
        public void ThenCanResolveTheSelectedIDocumentationBuilder(DocumentationFormat documentationFormat, Type builderType)
        {
            this.SetDocumentationFormat(documentationFormat);

            var item = Container.Resolve <IDocumentationBuilder>();

            Check.That(item).IsNotNull();
            Check.That(item).IsInstanceOfType(builderType);
        }
        public static LibraryDocumentationGenerator Create(Library library, DocumentationFormat format)
        {
            switch (format)
            {
            case DocumentationFormat.Npp:
                return(new NppLibraryDocumentationGenerator(library));

            default:
                throw new ArgumentOutOfRangeException(nameof(format), format, null);
            }
        }
Exemplo n.º 4
0
        public void ThenCanResolveTheSelectedIDocumentationBuilderAsSingleton(DocumentationFormat documentationFormat, Type builderType)
        {
            this.SetDocumentationFormat(documentationFormat);

            var item1 = Container.Resolve <IDocumentationBuilder>();
            var item2 = Container.Resolve <IDocumentationBuilder>();

            Check.That(item1).IsNotNull();
            Check.That(item1).IsInstanceOfType(builderType);
            Check.That(item2).IsNotNull();
            Check.That(item2).IsInstanceOfType(builderType);
            Check.That(item1).IsSameReferenceAs(item2);
        }
Exemplo n.º 5
0
        protected override string GenerateSingleCommandLine(
            MainModel model,
            string outputDirectory,
            DocumentationFormat documentationFormat,
            string selectedLanguage)
        {
            var result = new StringBuilder("pickles.exe");

            result.AppendFormat(" --feature-directory=\"{0}\"", model.FeatureDirectory);
            result.AppendFormatIfNotEmpty(" --output-directory=\"{0}\"", outputDirectory);
            result.AppendFormatIfNotEmpty(" --system-under-test-name={0}", model.ProjectName);
            result.AppendFormatIfNotEmpty(" --system-under-test-version={0}", model.ProjectVersion);

            if (model.IncludeTestResults)
            {
                result.AppendFormatIfNotEmpty(" --link-results-file=\"{0}\"", model.TestResultsFile);

                if (model.TestResultsFormat != TestResultsFormat.NUnit)
                {
                    result.AppendFormat(" --test-results-format={0}", model.TestResultsFormat.ToString().ToLowerInvariant());
                }
            }

            if (!string.Equals(selectedLanguage, "en", StringComparison.OrdinalIgnoreCase))
            {
                result.AppendFormatIfNotEmpty(" --language={0}", selectedLanguage);
            }

            if (documentationFormat != DocumentationFormat.Html)
            {
                result.AppendFormat(" --documentation-format={0}", documentationFormat.ToString().ToLowerInvariant());
            }

            if (model.IncludeExperimentalFeatures)
            {
                result.Append(" --include-experimental-features");
            }

            if (!model.EnableComments)
            {
                result.Append(" --enableComments=false");
            }

            result.AppendFormatIfNotEmpty(" --excludeTags={0}", model.ExcludeTags);
            result.AppendFormatIfNotEmpty(" --hideTags={0}", model.HideTags);

            return(result.ToString());
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        protected override string GenerateSingleCommandLine(
            MainModel model,
            string outputDirectory,
            DocumentationFormat documentationFormat,
            string selectedLanguage)
        {
            var result = new StringBuilder("Pickle-Features")
                         .AppendFormat(" -FeatureDirectory \"{0}\"", model.FeatureDirectory)
                         .AppendFormatIfNotEmpty(" -OutputDirectory \"{0}\"", outputDirectory)
                         .AppendFormatIfNotEmpty(" -SystemUnderTestName {0}", model.ProjectName)
                         .AppendFormatIfNotEmpty(" -SystemUnderTestVersion {0}", model.ProjectVersion);

            if (model.IncludeTestResults)
            {
                result.AppendFormatIfNotEmpty(" -TestResultsFile \"{0}\"", model.TestResultsFile);

                if (model.TestResultsFormat != TestResultsFormat.NUnit)
                {
                    result.AppendFormat(" -TestResultsFormat {0}", model.TestResultsFormat.ToString().ToLowerInvariant());
                }
            }

            if (!string.Equals(selectedLanguage, "en", StringComparison.OrdinalIgnoreCase))
            {
                result.AppendFormatIfNotEmpty(" -Language {0}", selectedLanguage);
            }

            if (documentationFormat != DocumentationFormat.Html)
            {
                result.AppendFormat(" -DocumentationFormat {0}", documentationFormat.ToString());
            }

            if (model.IncludeExperimentalFeatures)
            {
                result.Append(" -IncludeExperimentalFeatures");
            }

            if (!model.EnableComments)
            {
                result.Append(" -EnableComments false");
            }

            result.AppendFormatIfNotEmpty(" -ExcludeTags {0}", model.ExcludeTags);
            result.AppendFormatIfNotEmpty(" -HideTags {0}", model.HideTags);

            return(result.ToString());
        }
Exemplo n.º 7
0
        private Section AddSection(Element element, SectionType type, DocumentationFormat format, string content)
        {
            if (!(element is Container) && type == SectionType.Components)
            {
                throw new ArgumentException("Sections of type Components must be related to a container rather than a software system.");
            }


            Section section = new Section(element, type, format, content);

            if (!Sections.Contains(section))
            {
                Sections.Add(section);
                return(section);
            }
            else
            {
                throw new ArgumentException("A section of type " + type + " for " + element.Name + " already exists.");
            }
        }
Exemplo n.º 8
0
 protected abstract string GenerateSingleCommandLine(
     MainModel model,
     string outputDirectory,
     DocumentationFormat documentationFormat,
     string selectedLanguage);
Exemplo n.º 9
0
 public Section Add(Container container, DocumentationFormat format, string content)
 {
     return(AddSection(container, SectionType.Components, format, content));
 }
Exemplo n.º 10
0
        public Section Add(Container container, DocumentationFormat format, FileInfo fileInfo)
        {
            string content = File.ReadAllText(fileInfo.FullName, Encoding.UTF8);

            return(Add(container, format, content));
        }
Exemplo n.º 11
0
 public Section Add(SoftwareSystem softwareSystem, SectionType type, DocumentationFormat format, string content)
 {
     return(AddSection(softwareSystem, type, format, content));
 }
Exemplo n.º 12
0
        public Section Add(SoftwareSystem softwareSystem, SectionType type, DocumentationFormat format, FileInfo fileInfo)
        {
            string content = File.ReadAllText(fileInfo.FullName, Encoding.UTF8);

            return(Add(softwareSystem, type, format, content));
        }
 protected LibraryDocumentationGenerator(Library library, DocumentationFormat format)
 {
     Library = library;
     Format  = format;
 }
Exemplo n.º 14
0
        private void SetDocumentationFormat(DocumentationFormat documentationFormat)
        {
            var configuration = this.Configuration;

            configuration.DocumentationFormat = documentationFormat;
        }
Exemplo n.º 15
0
        public static void ParseArgs(string[] args)
        {
            var iterator = new ArgumentIterator(args);

            while (iterator.HasNext)
            {
                var arg = iterator.Current;

                switch (arg)
                {
                case "-Library":
                {
                    if (!iterator.TryGetNextArgument(out var libraryName))
                    {
                        throw new MissingArgumentValueException("Library", "library name");
                    }

                    sLibrary = LibraryLookup.GetLibrary(libraryName);
                    if (sLibrary == null)
                    {
                        throw new InvalidLibraryException(libraryName);
                    }
                }
                break;

                case "-DocFormat":
                {
                    if (!iterator.TryGetNextArgument(out var docFormatStr))
                    {
                        throw new MissingArgumentValueException("DocFormat", "documentation format name");
                    }

                    if (!Enum.TryParse <DocumentationFormat>(docFormatStr, out var docFormat) && !sDocFormatLookup.TryGetValue(docFormatStr, out docFormat))
                    {
                        throw new InvalidDocumentationFormatException(docFormatStr);
                    }

                    sDocFormat = docFormat;
                }
                break;

                case "-Out":
                {
                    if (!iterator.TryGetNextArgument(out var outPath))
                    {
                        throw new MissingArgumentValueException("Out", "out path");
                    }

                    sOutPath = outPath;
                }
                break;
                }
            }

            if (sLibrary == null)
            {
                throw new MissingMandatoryArgumentException("Library");
            }

            if (sDocFormat == DocumentationFormat.Unknown)
            {
                throw new MissingMandatoryArgumentException("DocFormat");
            }
        }