@@ -562,7 +562,7 @@ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine(double amount)
562
562
[ InlineData ( null ) ]
563
563
[ InlineData ( "John Doe" ) ]
564
564
[ InlineData ( "" ) ]
565
- public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_StringTest ( string studentName )
565
+ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_String_EquallsNull ( string studentName )
566
566
{
567
567
//Create Model
568
568
Student student = new Student { StudentName = studentName } ;
@@ -571,13 +571,61 @@ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_StringTest(string
571
571
{
572
572
FileContents = @"
573
573
{{ if-start:StudentName(=NULL) }}
574
- --is null--
574
+ --ok-passed--
575
+ {{ else-if }}
576
+ --error-failed--
577
+ {{ if-end:Balance }}"
578
+ } ;
579
+ string generatedTemplate = TemplateMapper . Map ( student , template ) ;
580
+ string expectedResult = string . IsNullOrEmpty ( studentName ) ? "\r \n \r \n --ok-passed--\r \n " : "\r \n \r \n --error-failed--\r \n " ;
581
+ Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
582
+ }
583
+
584
+ [ Theory ]
585
+ [ InlineData ( null ) ]
586
+ [ InlineData ( "John Doe" ) ]
587
+ [ InlineData ( "" ) ]
588
+ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_String_NotEquallsNull ( string studentName )
589
+ {
590
+ //Create Model
591
+ Student student = new Student { StudentName = studentName } ;
592
+ //Template
593
+ var template = new ObjectSemanticsTemplate
594
+ {
595
+ FileContents = @"
596
+ {{ if-start:StudentName(!=NULL) }}
597
+ --ok-passed--
598
+ {{ else-if }}
599
+ --error-failed--
600
+ {{ if-end:Balance }}"
601
+ } ;
602
+ string generatedTemplate = TemplateMapper . Map ( student , template ) ;
603
+ string expectedResult = ( ! string . IsNullOrEmpty ( studentName ) ) ? "\r \n \r \n --ok-passed--\r \n " : "\r \n \r \n --error-failed--\r \n " ;
604
+ Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
605
+ }
606
+
607
+
608
+
609
+ [ Theory ]
610
+ [ InlineData ( null ) ]
611
+ [ InlineData ( "John Doe" ) ]
612
+ [ InlineData ( "" ) ]
613
+ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_String_Equalls ( string studentName )
614
+ {
615
+ //Create Model
616
+ Student student = new Student { StudentName = studentName } ;
617
+ //Template
618
+ var template = new ObjectSemanticsTemplate
619
+ {
620
+ FileContents = @"
621
+ {{ if-start:StudentName(=John Doe) }}
622
+ --ok-passed--
575
623
{{ else-if }}
576
- --not-null --
624
+ --error-failed --
577
625
{{ if-end:Balance }}"
578
626
} ;
579
627
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 " ;
628
+ string expectedResult = ( studentName == "John Doe" ) ? "\r \n \r \n --ok-passed-- \r \n " : "\r \n \r \n --error-failed --\r \n " ;
581
629
Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
582
630
}
583
631
0 commit comments