@@ -9,49 +9,49 @@ namespace GitTools.Testing
9
9
/// </summary>
10
10
public class SequenceDiagram
11
11
{
12
- private readonly Dictionary < string , string > _participants = new ( ) ;
13
- private readonly StringBuilder _diagramBuilder ;
12
+ private readonly Dictionary < string , string > participants = new ( ) ;
13
+ private readonly StringBuilder diagramBuilder ;
14
14
15
15
/// <summary>
16
16
/// Initializes a new instance of the <see cref="T:SequenceDiagram"/> class.
17
17
/// </summary>
18
18
public SequenceDiagram ( )
19
19
{
20
- this . _diagramBuilder = new StringBuilder ( ) ;
21
- this . _diagramBuilder . AppendLine ( "@startuml" ) ;
20
+ this . diagramBuilder = new StringBuilder ( ) ;
21
+ this . diagramBuilder . AppendLine ( "@startuml" ) ;
22
22
}
23
23
24
24
/// <summary>
25
25
/// Activates a branch/participant in the sequence diagram
26
26
/// </summary>
27
- public void Activate ( string branch ) => this . _diagramBuilder . AppendLineFormat ( "activate {0}" , GetParticipant ( branch ) ) ;
27
+ public void Activate ( string branch ) => this . diagramBuilder . AppendLineFormat ( "activate {0}" , GetParticipant ( branch ) ) ;
28
28
29
29
/// <summary>
30
30
/// Destroys a branch/participant in the sequence diagram
31
31
/// </summary>
32
- public void Destroy ( string branch ) => this . _diagramBuilder . AppendLineFormat ( "destroy {0}" , GetParticipant ( branch ) ) ;
32
+ public void Destroy ( string branch ) => this . diagramBuilder . AppendLineFormat ( "destroy {0}" , GetParticipant ( branch ) ) ;
33
33
34
34
/// <summary>
35
35
/// Creates a participant in the sequence diagram
36
36
/// </summary>
37
37
public void Participant ( string participant , string @as = null )
38
38
{
39
- this . _participants . Add ( participant , @as ?? participant ) ;
39
+ this . participants . Add ( participant , @as ?? participant ) ;
40
40
if ( @as == null )
41
- this . _diagramBuilder . AppendLineFormat ( "participant {0}" , participant ) ;
41
+ this . diagramBuilder . AppendLineFormat ( "participant {0}" , participant ) ;
42
42
else
43
- this . _diagramBuilder . AppendLineFormat ( "participant \" {0}\" as {1}" , participant , @as ) ;
43
+ this . diagramBuilder . AppendLineFormat ( "participant \" {0}\" as {1}" , participant , @as ) ;
44
44
}
45
45
46
46
/// <summary>
47
47
/// Appends a divider with specified text to the sequence diagram
48
48
/// </summary>
49
- public void Divider ( string text ) => this . _diagramBuilder . AppendLineFormat ( "== {0} ==" , text ) ;
49
+ public void Divider ( string text ) => this . diagramBuilder . AppendLineFormat ( "== {0} ==" , text ) ;
50
50
51
51
/// <summary>
52
52
/// Appends a note over one or many participants to the sequence diagram
53
53
/// </summary>
54
- public void NoteOver ( string noteText , string startParticipant , string endParticipant = null , string prefix = null , string color = null ) => this . _diagramBuilder . AppendLineFormat (
54
+ public void NoteOver ( string noteText , string startParticipant , string endParticipant = null , string prefix = null , string color = null ) => this . diagramBuilder . AppendLineFormat (
55
55
prefix + @"note over {0}{1}{2}
56
56
{3}
57
57
end note" ,
@@ -63,20 +63,20 @@ public void NoteOver(string noteText, string startParticipant, string endPartici
63
63
/// <summary>
64
64
/// Appends applying a tag to the specified branch/participant to the sequence diagram
65
65
/// </summary>
66
- public void ApplyTag ( string tag , string toBranch ) => this . _diagramBuilder . AppendLineFormat ( "{0} -> {0}: tag {1}" , GetParticipant ( toBranch ) , tag ) ;
66
+ public void ApplyTag ( string tag , string toBranch ) => this . diagramBuilder . AppendLineFormat ( "{0} -> {0}: tag {1}" , GetParticipant ( toBranch ) , tag ) ;
67
67
68
68
/// <summary>
69
69
/// Appends branching from a branch to another branch, @as can override the participant name
70
70
/// </summary>
71
71
public void BranchTo ( string branchName , string currentName , string @as )
72
72
{
73
- if ( ! this . _participants . ContainsKey ( branchName ) )
73
+ if ( ! this . participants . ContainsKey ( branchName ) )
74
74
{
75
- this . _diagramBuilder . Append ( "create " ) ;
75
+ this . diagramBuilder . Append ( "create " ) ;
76
76
Participant ( branchName , @as ) ;
77
77
}
78
78
79
- this . _diagramBuilder . AppendLineFormat (
79
+ this . diagramBuilder . AppendLineFormat (
80
80
"{0} -> {1}: branch from {2}" ,
81
81
GetParticipant ( currentName ) ,
82
82
GetParticipant ( branchName ) , currentName ) ;
@@ -87,41 +87,41 @@ public void BranchTo(string branchName, string currentName, string @as)
87
87
/// </summary>
88
88
public void BranchToFromTag ( string branchName , string fromTag , string onBranch , string @as )
89
89
{
90
- if ( ! this . _participants . ContainsKey ( branchName ) )
90
+ if ( ! this . participants . ContainsKey ( branchName ) )
91
91
{
92
- this . _diagramBuilder . Append ( "create " ) ;
92
+ this . diagramBuilder . Append ( "create " ) ;
93
93
Participant ( branchName , @as ) ;
94
94
}
95
95
96
- this . _diagramBuilder . AppendLineFormat ( "{0} -> {1}: branch from tag ({2})" , GetParticipant ( onBranch ) , GetParticipant ( branchName ) , fromTag ) ;
96
+ this . diagramBuilder . AppendLineFormat ( "{0} -> {1}: branch from tag ({2})" , GetParticipant ( onBranch ) , GetParticipant ( branchName ) , fromTag ) ;
97
97
}
98
98
99
99
/// <summary>
100
100
/// Appends a commit on the target participant/branch to the sequence diagram
101
101
/// </summary>
102
- public void MakeACommit ( string toParticipant ) => this . _diagramBuilder . AppendLineFormat ( "{0} -> {0}: commit" , GetParticipant ( toParticipant ) ) ;
102
+ public void MakeACommit ( string toParticipant ) => this . diagramBuilder . AppendLineFormat ( "{0} -> {0}: commit" , GetParticipant ( toParticipant ) ) ;
103
103
104
104
/// <summary>
105
105
/// Append a merge to the sequence diagram
106
106
/// </summary>
107
- public void Merge ( string @from , string to ) => this . _diagramBuilder . AppendLineFormat ( "{0} -> {1}: merge" , GetParticipant ( @from ) , GetParticipant ( to ) ) ;
107
+ public void Merge ( string @from , string to ) => this . diagramBuilder . AppendLineFormat ( "{0} -> {1}: merge" , GetParticipant ( @from ) , GetParticipant ( to ) ) ;
108
108
109
109
private string GetParticipant ( string branch )
110
110
{
111
- if ( this . _participants . ContainsKey ( branch ) )
112
- return this . _participants [ branch ] ;
111
+ if ( this . participants . ContainsKey ( branch ) )
112
+ return this . participants [ branch ] ;
113
113
114
114
return branch ;
115
115
}
116
116
117
117
/// <summary>
118
118
/// Ends the sequence diagram
119
119
/// </summary>
120
- public void End ( ) => this . _diagramBuilder . AppendLine ( "@enduml" ) ;
120
+ public void End ( ) => this . diagramBuilder . AppendLine ( "@enduml" ) ;
121
121
122
122
/// <summary>
123
123
/// returns the plantUML representation of the Sequence Diagram
124
124
/// </summary>
125
- public string GetDiagram ( ) => this . _diagramBuilder . ToString ( ) ;
125
+ public string GetDiagram ( ) => this . diagramBuilder . ToString ( ) ;
126
126
}
127
127
}
0 commit comments