1- import { String } from '../dist/index' ;
1+ import { String , StringBuilder } from '../dist/index' ;
22import { Fruit } from './fruit' ;
33import { expect } from 'chai' ;
44import 'mocha' ;
@@ -235,4 +235,56 @@ describe('String.Join', () => {
235235 console . log ( result ) ;
236236 expect ( result ) . to . equal ( "Foo.Bar" ) ;
237237 } ) ;
238+ } ) ;
239+
240+ describe ( 'String.Append' , ( ) => {
241+ it ( 'should append characters' , ( ) => {
242+ var builder = new StringBuilder ( ) ;
243+ builder . Append ( 'First Part... ' ) ;
244+ builder . Append ( 'Second Part...' ) ;
245+
246+ expect ( builder . ToString ( ) ) . to
247+ . equal ( 'First Part... Second Part...' ) ;
248+ } ) ;
249+
250+ it ( 'should append characters' , ( ) => {
251+ var builder = new StringBuilder ( ) ;
252+ builder . AppendFormat ( 'First {0}... ' , 'Part' ) ;
253+ builder . AppendFormat ( 'Second {0}...' , 'Part' ) ;
254+
255+ console . log ( builder . ToString ( ) ) ;
256+ expect ( builder . ToString ( ) ) . to
257+ . equal ( 'First Part... Second Part...' ) ;
258+ } ) ;
259+ } ) ;
260+
261+ describe ( 'String.AppendLine' , ( ) => {
262+ it ( 'should append characters and new line' , ( ) => {
263+ var builder = new StringBuilder ( ) ;
264+ builder . AppendLine ( 'First Line...' ) ;
265+ builder . AppendLine ( 'Second Line...' ) ;
266+
267+ expect ( builder . ToString ( ) ) . to
268+ . equal ( '\r\nFirst Line...\r\nSecond Line...' ) ;
269+ } ) ;
270+
271+ it ( 'should append characters and new line' , ( ) => {
272+ var builder = new StringBuilder ( ) ;
273+ builder . AppendLineFormat ( 'First {0}...' , 'Line' ) ;
274+ builder . AppendLineFormat ( 'Second {0}...' , 'Line' ) ;
275+
276+ console . log ( builder . ToString ( ) ) ;
277+ expect ( builder . ToString ( ) ) . to
278+ . equal ( '\r\nFirst Line...\r\nSecond Line...' ) ;
279+ } ) ;
280+
281+ it ( 'should append characters and new line' , ( ) => {
282+ var builder = new StringBuilder ( ) ;
283+ builder . AppendLine ( 'First Line...' ) ;
284+ builder . AppendLine ( 'Second Line...' ) ;
285+
286+ console . log ( builder . ToString ( ) ) ;
287+ expect ( builder . ToString ( ) ) . to
288+ . equal ( '\r\nFirst Line...\r\nSecond Line...' ) ;
289+ } ) ;
238290} ) ;
0 commit comments