This repository was archived by the owner on Oct 28, 2021. It is now read-only.
File tree 2 files changed +22
-0
lines changed
src/SymphonyOSS.RestApiClient/MessageML
test/SymphonyOSS.RestApiClient.Tests
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ public MessageBuilder Link(string href)
139
139
return this ;
140
140
}
141
141
142
+ /// <summary>
143
+ /// Appends a line break.
144
+ /// </summary>
145
+ /// <returns>Itself to allow for chaining.</returns>
146
+ public MessageBuilder NewLine ( )
147
+ {
148
+ var xmlElement = _xmlDocument . CreateElement ( "br" ) ;
149
+ _rootElement . AppendChild ( xmlElement ) ;
150
+ return this ;
151
+ }
152
+
142
153
/// <summary>
143
154
/// Constructs the string representation of this message.
144
155
/// </summary>
Original file line number Diff line number Diff line change @@ -67,5 +67,16 @@ public void EnsureMentions_are_inserted()
67
67
. ToString ( ) ;
68
68
Assert . Equal ( "<messageML><mention uid=\" 12345\" /><mention email=\" [email protected] \" /></messageML>" , emptyMessage ) ;
69
69
}
70
+
71
+ [ Fact ]
72
+ public void EnsureNewLine_is_inserted ( )
73
+ {
74
+ var emptyMessage = new MessageBuilder ( )
75
+ . Text ( "line 1" )
76
+ . NewLine ( )
77
+ . Text ( "line 2" )
78
+ . ToString ( ) ;
79
+ Assert . Equal ( "<messageML>line 1<br />line 2</messageML>" , emptyMessage ) ;
80
+ }
70
81
}
71
82
}
You can’t perform that action at this time.
0 commit comments