-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#24: Fixed Sequence Diagram issue when there was loop after loop
- Loading branch information
1 parent
6458605
commit 94a2359
Showing
5 changed files
with
147 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 54 additions & 2 deletions
56
Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,58 @@ | ||
namespace Synergy.Architecture.Tests.Samples; | ||
using Synergy.Architecture.Annotations.Diagrams.Sequence; | ||
using Synergy.Architecture.Diagrams.Documentation; | ||
using Synergy.Architecture.Diagrams.Sequence; | ||
using Synergy.Documentation.Code; | ||
|
||
namespace Synergy.Architecture.Tests.Samples; | ||
|
||
public class SequenceDiagramSamples | ||
{ | ||
// TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: provide samples here | ||
public static CodeFile SequenceDiagrams => CodeFolder.Current() | ||
.File($"{nameof(SequenceDiagramSamples)}.md"); | ||
|
||
[Fact] | ||
public async Task Sequence() | ||
{ | ||
var blueprint = TechnicalBlueprint | ||
.Titled("Sequence diagrams samples") | ||
.Add(SequenceDiagramSamples.IfElseDiagrams()) | ||
.Add(LoopAfterLoopDiagram()) | ||
; | ||
|
||
await File.WriteAllTextAsync(SequenceDiagrams.FilePath, blueprint.Render()); | ||
} | ||
|
||
private static IEnumerable<SequenceDiagram> IfElseDiagrams() | ||
{ | ||
yield return SequenceDiagram | ||
.From(new SequenceDiagramActor("Some actor", Note: "very hand some")) | ||
.Calling<SequenceDiagramSamples>(c => c.IfElse()) | ||
.Footer("This diagram shows if-else." | ||
); | ||
} | ||
|
||
[SequenceDiagramExternalCall("Chrome", "https://www.google.com", Group = SequenceDiagramGroupType.Alt, GroupHeader = "when google is available")] | ||
[SequenceDiagramExternalCall("Firefox", "https://www.foogle.com", Group = SequenceDiagramGroupType.Alt, GroupHeader = "when google is available")] | ||
[SequenceDiagramExternalCall("Firefox", "https://www.google.com", Group = SequenceDiagramGroupType.Else, GroupHeader = "otherwise")] | ||
private void IfElse() | ||
{ | ||
} | ||
|
||
private static IEnumerable<SequenceDiagram> LoopAfterLoopDiagram() | ||
{ | ||
yield return SequenceDiagram | ||
.From(new SequenceDiagramActor("Some actor", Note: "very hand some")) | ||
.Calling<SequenceDiagramSamples>(c => c.LoopAfterLoop()) | ||
.Footer("This diagram shows loop placed after another loop." | ||
); | ||
} | ||
|
||
[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")] | ||
private void LoopAfterLoop() | ||
{ | ||
} | ||
|
||
|
||
} |
75 changes: 75 additions & 0 deletions
75
Architecture/Synergy.Architecture.Tests/Samples/SequenceDiagramSamples.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Sequence diagrams samples | ||
|
||
## SequenceDiagramSamples.IfElse() | ||
|
||
**Root type:** `SequenceDiagramSamples` (from: `Synergy.Architecture.Tests`) | ||
|
||
**Root method:** | ||
``` | ||
IfElse() : void | ||
``` | ||
|
||
![Sequence Diagram for SequenceDiagramSamples.IfElse()](http://www.plantuml.com/plantuml/png/V9BFJiCm3CRlbVeEravmQ7Ulq3J-IXmuZJiodTj4f769lGMUZGEFn2kGhjFOnBPR7Fq-v_Fd_7nzpqKnwAfpUIPlrlSOi8D0qhCNUY8HREc67CVh43Y2XXNbMSEi5E3PM86bnNRGYE4eO9k2d52PPshL9NH1xoloDTsDs0Axtf6KZyrzmYukyupySejYhHnWmHszZ4SKc0mbRCf9dat1fuU1rxJFLP3gJp3ebo3fDi_I56fhswDNE6xWaBaruP_kmGPg-2DDi7kec1rlLi7VEEWKeY4FBNFh2592k4RhyFLq6iLiD521KUsbcavZZENOeAovEwtRcZmKfktiXCCoWDLGY5RE63ZQQDz1MjD-55T5SIhOUK8t_-aN003__mC0) | ||
<!-- | ||
@startuml | ||
skinparam responseMessageBelowArrow true | ||
footer This diagram shows if-else. | ||
title | ||
SequenceDiagramSamples.IfElse() | ||
endtitle | ||
actor Some_actor as "Some actor" | ||
/ note over Some_actor: very hand some | ||
participant SequenceDiagramSamples | ||
participant Chrome | ||
participant Firefox | ||
Some_actor->SequenceDiagramSamples: IfElse() | ||
alt when google is available | ||
SequenceDiagramSamples->Chrome: https://www.google.com | ||
SequenceDiagramSamples->Firefox: https://www.foogle.com | ||
else otherwise | ||
SequenceDiagramSamples->Firefox: https://www.google.com | ||
end | ||
Some_actor<--SequenceDiagramSamples | ||
@enduml | ||
--> | ||
|
||
This diagram shows if-else. | ||
|
||
|
||
## SequenceDiagramSamples.LoopAfterLoop() | ||
|
||
**Root type:** `SequenceDiagramSamples` (from: `Synergy.Architecture.Tests`) | ||
|
||
**Root method:** | ||
``` | ||
LoopAfterLoop() : void | ||
``` | ||
|
||
![Sequence Diagram for SequenceDiagramSamples.LoopAfterLoop()](http://www.plantuml.com/plantuml/png/b5AnJiCm4DqZvHzEdM18kaUeQW4nmLHsT2INsCBn6TiXy6qCV1A_m3cjIgksGwVusU_TlRkNt--VPOZeuz2RF0jlsZhqs8EduDW6Ug8GiADRCZoklESHeXyeprhcI1wUbGxGQEoI9YWU0nXc1yvWJGrWcqXeEIhvffSopwAEHYgiwNqWMzFzHht6tXaAvQEGLacM3bVNUKQssIgmZknXpJszR8uOO9OWJ72MPtEGLWJyGVky2WH_WKBRG93RF9CPewwrGnlXj8z3pftoHxe7xQdbJnbarwXOd2vMmT5KqvOIqBQ3mKPj9cjH9QpGERBYuNIvOh7nKu6AqOLgFX_7iUoOEqDbpVrvtTRpeL2Yt0bbsLjlKxAIw60QU2N9k6t9ayoTNY_ii6zjwl2_ifkYE1V0KgZJN_a7003__mC0) | ||
<!-- | ||
@startuml | ||
skinparam responseMessageBelowArrow true | ||
footer This diagram shows loop placed after another loop. | ||
title | ||
SequenceDiagramSamples.LoopAfterLoop() | ||
endtitle | ||
actor Some_actor as "Some actor" | ||
/ note over Some_actor: very hand some | ||
participant SequenceDiagramSamples | ||
participant Chrome | ||
participant Firefox | ||
Some_actor->SequenceDiagramSamples: LoopAfterLoop() | ||
loop Looping until something happens | ||
SequenceDiagramSamples->Chrome: https://www.google.com | ||
SequenceDiagramSamples->Firefox: https://www.foogle.com | ||
end | ||
loop This should be different loop | ||
SequenceDiagramSamples->Firefox: https://www.google.com | ||
end | ||
Some_actor<--SequenceDiagramSamples | ||
@enduml | ||
--> | ||
|
||
This diagram shows loop placed after another loop. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters