public void Test_AddAllSectionsWithContentAsstrings()
        {
            Section section;

            section = _template.AddContextSection(_softwareSystem, Format.Markdown, "Context section");
            AssertSection(_softwareSystem, "Context", 1, Format.Markdown, "Context section", 1, section);

            section = _template.AddFunctionalOverviewSection(_softwareSystem, Format.Markdown, "Functional overview section");
            AssertSection(_softwareSystem, "Functional Overview", 2, Format.Markdown, "Functional overview section", 2, section);

            section = _template.AddQualityAttributesSection(_softwareSystem, Format.Markdown, "Quality attributes section");
            AssertSection(_softwareSystem, "Quality Attributes", 2, Format.Markdown, "Quality attributes section", 3, section);

            section = _template.AddConstraintsSection(_softwareSystem, Format.Markdown, "Constraints section");
            AssertSection(_softwareSystem, "Constraints", 2, Format.Markdown, "Constraints section", 4, section);

            section = _template.AddPrinciplesSection(_softwareSystem, Format.Markdown, "Principles section");
            AssertSection(_softwareSystem, "Principles", 2, Format.Markdown, "Principles section", 5, section);

            section = _template.AddSoftwareArchitectureSection(_softwareSystem, Format.Markdown, "Software architecture section");
            AssertSection(_softwareSystem, "Software Architecture", 3, Format.Markdown, "Software architecture section", 6, section);

            section = _template.AddContainersSection(_softwareSystem, Format.Markdown, "Containers section");
            AssertSection(_softwareSystem, "Containers", 3, Format.Markdown, "Containers section", 7, section);

            section = _template.AddComponentsSection(_containerA, Format.Markdown, "Components section for container A");
            AssertSection(_containerA, "Components", 3, Format.Markdown, "Components section for container A", 8, section);

            section = _template.AddComponentsSection(_containerB, Format.Markdown, "Components section for container B");
            AssertSection(_containerB, "Components", 3, Format.Markdown, "Components section for container B", 9, section);

            section = _template.AddCodeSection(_componentA1, Format.Markdown, "Code section for component A1");
            AssertSection(_componentA1, "Code", 3, Format.Markdown, "Code section for component A1", 10, section);

            section = _template.AddCodeSection(_componentA2, Format.Markdown, "Code section for component A2");
            AssertSection(_componentA2, "Code", 3, Format.Markdown, "Code section for component A2", 11, section);

            section = _template.AddDataSection(_softwareSystem, Format.Markdown, "Data section");
            AssertSection(_softwareSystem, "Data", 3, Format.Markdown, "Data section", 12, section);

            section = _template.AddInfrastructureArchitectureSection(_softwareSystem, Format.Markdown, "Infrastructure architecture section");
            AssertSection(_softwareSystem, "Infrastructure Architecture", 4, Format.Markdown, "Infrastructure architecture section", 13, section);

            section = _template.AddDeploymentSection(_softwareSystem, Format.Markdown, "Deployment section");
            AssertSection(_softwareSystem, "Deployment", 4, Format.Markdown, "Deployment section", 14, section);

            section = _template.AddDevelopmentEnvironmentSection(_softwareSystem, Format.Markdown, "Development environment section");
            AssertSection(_softwareSystem, "Development Environment", 4, Format.Markdown, "Development environment section", 15, section);

            section = _template.AddOperationAndSupportSection(_softwareSystem, Format.Markdown, "Operation and support section");
            AssertSection(_softwareSystem, "Operation and Support", 4, Format.Markdown, "Operation and support section", 16, section);

            section = _template.AddDecisionLogSection(_softwareSystem, Format.Markdown, "Decision log section");
            AssertSection(_softwareSystem, "Decision Log", 5, Format.Markdown, "Decision log section", 17, section);
        }
        static void Main()
        {
            Workspace workspace = new Workspace("Documentation - Structurizr", "An empty software architecture document using the Structurizr template.");
            Model     model     = workspace.Model;
            ViewSet   views     = workspace.Views;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            SystemContextView contextView = views.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = views.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.Person)
            {
                Shape = Shape.Person
            });

            StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

            // this is the Markdown version
            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "structurizr" + Path.DirectorySeparatorChar + "markdown");

            template.AddContextSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-context.md")));
            template.AddFunctionalOverviewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-functional-overview.md")));
            template.AddQualityAttributesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-quality-attributes.md")));
            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-constraints.md")));
            template.AddPrinciplesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-principles.md")));
            template.AddSoftwareArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-software-architecture.md")));
            template.AddDataSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-data.md")));
            template.AddInfrastructureArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-infrastructure-architecture.md")));
            template.AddDeploymentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-deployment.md")));
            template.AddDevelopmentEnvironmentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-development-environment.md")));
            template.AddOperationAndSupportSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-operation-and-support.md")));
            template.AddDecisionLogSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-decision-log.md")));

            // this is the AsciiDoc version
//            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "structurizr" + Path.DirectorySeparatorChar + "asciidoc");
//            template.AddContextSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-context.adoc")));
//            template.AddFunctionalOverviewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-functional-overview.adoc")));
//            template.AddQualityAttributesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-quality-attributes.adoc")));
//            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-constraints.adoc")));
//            template.AddPrinciplesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-principles.adoc")));
//            template.AddSoftwareArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-software-architecture.adoc")));
//            template.AddDataSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-data.adoc")));
//            template.AddInfrastructureArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-infrastructure-architecture.adoc")));
//            template.AddDeploymentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-deployment.adoc")));
//            template.AddDevelopmentEnvironmentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-development-environment.adoc")));
//            template.AddOperationAndSupportSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-operation-and-support.adoc")));
//            template.AddDecisionLogSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-decision-log.adoc")));

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspaceAsync(WorkspaceId, workspace).Wait();
        }
Beispiel #3
0
        static void Main()
        {
            Workspace workspace = new Workspace("Corporate Branding", "This is a model of my software system.");
            Model     model     = workspace.Model;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            ViewSet           views       = workspace.Views;
            SystemContextView contextView = views.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = views.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.Person)
            {
                Shape = Shape.Person
            });

            StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

            template.AddContextSection(softwareSystem, Format.Markdown, "Here is some context about the software system...\n\n![](embed:SystemContext)");
            template.AddQualityAttributesSection(softwareSystem, Format.Markdown, "Here is some information about the quality attributes...");
            template.AddSoftwareArchitectureSection(softwareSystem, Format.Markdown, "Here is some information about the software architecture...");
            template.AddOperationAndSupportSection(softwareSystem, Format.Markdown, "Here is some information about how to operate and support the software...");
            template.AddDecisionLogSection(softwareSystem, Format.Markdown, "Here is some information about the decisions made...");

            Branding branding = views.Configuration.Branding;

            branding.Color1 = new ColorPair("#02172c", "#ffffff");
            branding.Color2 = new ColorPair("#08427b", "#ffffff");
            branding.Color3 = new ColorPair("#1168bd", "#ffffff");
            branding.Color4 = new ColorPair("#438dd5", "#ffffff");
            branding.Color5 = new ColorPair("#85bbf0", "#ffffff");
            branding.Logo   = ImageUtils.GetImageAsDataUri(new FileInfo("structurizr-logo.png"));

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspace(WorkspaceId, workspace);
        }