diff --git a/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md b/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md index 9b858b5..d428c36 100644 --- a/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md +++ b/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md @@ -1,6 +1,6 @@ # Technical Debt for Synergy.Contracts -Total: 9 +Total: 8 ## [SequenceDiagramDeactivationAttribute.cs](../../../Synergy.Architecture.Annotations/Diagrams/Sequence/SequenceDiagramDeactivationAttribute.cs) - TODO: Marcin Celej [from: Marcin Celej on: 21-05-2023]: Use this attribute in some sample diff --git a/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.cs b/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.cs index 277a8ce..8f250cc 100644 --- a/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.cs +++ b/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.cs @@ -2,6 +2,7 @@ using Synergy.Architecture.Diagrams.Documentation; using Synergy.Architecture.Diagrams.Sequence; using Synergy.Documentation.Code; +using static Synergy.Architecture.Annotations.Diagrams.Sequence.SequenceDiagramGroupType; namespace Synergy.Architecture.Tests.Samples; @@ -15,14 +16,15 @@ public async Task Sequence() { var blueprint = TechnicalBlueprint .Titled("Sequence diagrams samples") - .Add(SequenceDiagramSamples.IfElseDiagrams()) - .Add(LoopAfterLoopDiagram()) + .Add(this.IfElseDiagrams()) + .Add(this.LoopAfterLoopDiagram()) + .Add(this.DatabaseDiagrams()) ; await File.WriteAllTextAsync(SequenceDiagrams.FilePath, blueprint.Render()); } - private static IEnumerable IfElseDiagrams() + private IEnumerable IfElseDiagrams() { yield return SequenceDiagram .From(new SequenceDiagramActor("Some actor", Note: "very hand some")) @@ -36,9 +38,9 @@ private static IEnumerable IfElseDiagrams() [SequenceDiagramExternalCall("Firefox", "https://www.google.com", Group = SequenceDiagramGroupType.Else, GroupHeader = "otherwise")] private void IfElse() { - } + } - private static IEnumerable LoopAfterLoopDiagram() + private IEnumerable LoopAfterLoopDiagram() { yield return SequenceDiagram .From(new SequenceDiagramActor("Some actor", Note: "very hand some")) @@ -47,12 +49,26 @@ private static IEnumerable LoopAfterLoopDiagram() ); } - [SequenceDiagramExternalCall("Chrome", "https://www.google.com", Group = SequenceDiagramGroupType.Loop, GroupHeader = "Looping until something happens")] - [SequenceDiagramExternalCall("Firefox", "https://www.foogle.com", Group = SequenceDiagramGroupType.Loop, GroupHeader = "Looping until something happens")] - [SequenceDiagramExternalCall("Firefox", "https://www.google.com", Group = SequenceDiagramGroupType.Loop, GroupHeader = "This should be different loop")] + [SequenceDiagramExternalCall("Chrome", "https://www.google.com", Group = Loop, GroupHeader = "Looping until something happens")] + [SequenceDiagramExternalCall("Firefox", "https://www.foogle.com", Group =Loop, GroupHeader = "Looping until something happens")] + [SequenceDiagramExternalCall("Firefox", "https://www.google.com", Group =Loop, GroupHeader = "This should be different loop")] private void LoopAfterLoop() { } - + private IEnumerable DatabaseDiagrams() + { + yield return SequenceDiagram + .From(new SequenceDiagramActor("Some actor", Note: "very hand some")) + .Calling(c => c.Database()) + .Footer("This diagram shows standard database operations." + ); + } + + [SequenceDiagramDatabaseCall($"SELECT * FROM [Item] WHERE [Id] = @itemId")] + [SequenceDiagramDatabaseCall($"INSERT INTO [Item] VALUES ...", Group = Alt, GroupHeader = "if item does not exist yet")] + [SequenceDiagramDatabaseCall($"Item [Table] SET ... WHERE [Id] = @itemId", Group = Else, GroupHeader = "else")] + private void Database() + { + } } \ No newline at end of file diff --git a/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.md b/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.md index 639cd22..548693c 100644 --- a/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.md +++ b/Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.md @@ -73,3 +73,38 @@ Some_actor<--SequenceDiagramSamples This diagram shows loop placed after another loop. +## SequenceDiagramSamples.Database() + +**Root type:** `SequenceDiagramSamples` (from: `Synergy.Architecture.Tests`) + +**Root method:** +``` + Database() : void +``` + +![Sequence Diagram for SequenceDiagramSamples.Database()](http://www.plantuml.com/plantuml/png/Z59DJm8n5Bnlil_XXPEQBDw94b3MI0AIiAiU234F-e36tUtQzn3zRHxyIVu5t_8L3f1mQJlDp7IcxT_FRui5lIppB0putHObUip14vUkOEeJCyxfZZAtQdllLY1-IM4mSqx8Gxgm3CRYlDBmmgqOrAqmw0qO59mW4xYIF8fLkteOY9LCzGbzBAcOKcUZJJ0lC-9wPwkvk0m3AioMZ5Dn7XANqzjcYGor2i8QriBW6WhD0-wJ3daDKFmD2mq4hBjXeEN4Jcs9XS3n266mpxqBesdtbb7pkAm1Xz6FSwBcZjE09Ex5zobSmSDmq8THLoWVm-jZF8mLc37SGilgNjTe-qp0pg22O1nnLHNeoxB0DyavXtMVadYOwfGETaUzj7lFSGBrkZu9PLgs6ixogcACKfnaDDOMQMLn8hW-uE7LtKJHgIjlANNz0Vy1003__mC0) + + +This diagram shows standard database operations. + +