@@ -411,20 +411,7 @@ public void Should_Act_On_IfCondition_Equality_Checks(string condition, double a
411411 }
412412
413413
414- [ Fact ]
415- public void Should_Act_On_IfCondition_Simple_Property_String_Equality ( )
416- {
417- //Create Model
418- Student student = new Student { StudentName = "John Doe" } ;
419- //Template
420- var template = new ObjectSemanticsTemplate
421- {
422- FileContents = "{{ if-start:studentName(=John Doe) }} YES, i am John Doe {{ if-end:studentName }}"
423- } ;
424- string generatedTemplate = TemplateMapper . Map ( student , template ) ;
425- string expectedResult = " YES, i am John Doe " ;
426- Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
427- }
414+
428415
429416
430417 [ Fact ]
@@ -571,6 +558,44 @@ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine(double amount)
571558 Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
572559 }
573560
561+ [ Theory ]
562+ [ InlineData ( null ) ]
563+ [ InlineData ( "John Doe" ) ]
564+ [ InlineData ( "" ) ]
565+ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_StringTest ( string studentName )
566+ {
567+ //Create Model
568+ Student student = new Student { StudentName = studentName } ;
569+ //Template
570+ var template = new ObjectSemanticsTemplate
571+ {
572+ FileContents = @"
573+ {{ if-start:StudentName(=NULL) }}
574+ --is null--
575+ {{ else-if }}
576+ --not-null--
577+ {{ if-end:Balance }}"
578+ } ;
579+ string generatedTemplate = TemplateMapper . Map ( student , template ) ;
580+ string expectedResult = ( string . IsNullOrEmpty ( studentName ) ) ? "\r \n \r \n --is null--\r \n " : "\r \n \r \n --not-null--\r \n " ;
581+ Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
582+ }
583+
584+
585+ [ Fact ]
586+ public void Should_Act_On_IfCondition_Simple_Property_String_Equality ( )
587+ {
588+ //Create Model
589+ Student student = new Student { StudentName = "John Doe" } ;
590+ //Template
591+ var template = new ObjectSemanticsTemplate
592+ {
593+ FileContents = "{{ if-start:studentName(=John Doe) }} YES, i am John Doe {{ if-end:studentName }}"
594+ } ;
595+ string generatedTemplate = TemplateMapper . Map ( student , template ) ;
596+ string expectedResult = " YES, i am John Doe " ;
597+ Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
598+ }
574599
575600
576601 [ Theory ]
0 commit comments