@@ -562,7 +562,7 @@ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine(double amount)
562562 [ InlineData ( null ) ]
563563 [ InlineData ( "John Doe" ) ]
564564 [ 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 )
566566 {
567567 //Create Model
568568 Student student = new Student { StudentName = studentName } ;
@@ -571,13 +571,61 @@ public void Should_Act_On_IfCondition_Having_ElseIf_MultiLine_StringTest(string
571571 {
572572 FileContents = @"
573573{{ 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--
575623{{ else-if }}
576- --not-null --
624+ --error-failed --
577625{{ if-end:Balance }}"
578626 } ;
579627 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 " ;
581629 Assert . Equal ( expectedResult , generatedTemplate , false , true , true ) ;
582630 }
583631
0 commit comments