@@ -645,5 +645,67 @@ param intParam int
645
645
File . Exists ( Path . Combine ( bicepOutputPath , outputFile ) ) . Should ( ) . Be ( true , f ) ;
646
646
}
647
647
}
648
+
649
+ [ TestMethod ]
650
+ public async Task BuildParams_Extends_InvalidType_ThrowsError ( )
651
+ {
652
+ var outputPath = FileHelper . GetUniqueTestOutputPath ( TestContext ) ;
653
+ FileHelper . SaveResultFile ( TestContext , "main.bicep" , @"
654
+ param tag string
655
+ " , outputPath ) ;
656
+ FileHelper . SaveResultFile ( TestContext , "base.bicepparam" , @"
657
+ using none
658
+ param tag = 42
659
+ " , outputPath ) ;
660
+ var inputFile = FileHelper . SaveResultFile ( TestContext , "main.bicepparam" , @"
661
+ using 'main.bicep'
662
+ extends 'base.bicepparam'
663
+ " , outputPath ) ;
664
+
665
+ var expectedOutputFile = FileHelper . GetResultFilePath ( TestContext , "main.json" , outputPath ) ;
666
+ File . Exists ( expectedOutputFile ) . Should ( ) . BeFalse ( ) ;
667
+
668
+ var ( output , error , result ) = await Bicep ( [ "build-params" , inputFile ] ) ;
669
+
670
+ File . Exists ( expectedOutputFile ) . Should ( ) . BeFalse ( ) ;
671
+
672
+ output . Should ( ) . BeEmpty ( ) ;
673
+ error . Should ( ) . Contain ( "Error BCP033: Expected a value of type \" string\" but the provided value is of type \" 42\" ." ) ;
674
+ result . Should ( ) . Be ( 1 ) ;
675
+ }
676
+
677
+ [ TestMethod ]
678
+ public async Task BuildParams_Extends_Multiple_InvalidType_ThrowsMultipleErrors ( )
679
+ {
680
+ var outputPath = FileHelper . GetUniqueTestOutputPath ( TestContext ) ;
681
+ FileHelper . SaveResultFile ( TestContext , "main.bicep" , @"
682
+ param myString string
683
+ param myInt int
684
+ param myBool bool
685
+ " , outputPath ) ;
686
+ FileHelper . SaveResultFile ( TestContext , "base.bicepparam" , @"
687
+ using none
688
+ param myInt = '42'
689
+ param myString = {}
690
+ param myBool = []
691
+ " , outputPath ) ;
692
+ var inputFile = FileHelper . SaveResultFile ( TestContext , "main.bicepparam" , @"
693
+ using './main.bicep'
694
+ extends 'base.bicepparam'
695
+ " , outputPath ) ;
696
+
697
+ var expectedOutputFile = FileHelper . GetResultFilePath ( TestContext , "main.json" , outputPath ) ;
698
+ File . Exists ( expectedOutputFile ) . Should ( ) . BeFalse ( ) ;
699
+
700
+ var ( output , error , result ) = await Bicep ( [ "build-params" , inputFile ] ) ;
701
+
702
+ File . Exists ( expectedOutputFile ) . Should ( ) . BeFalse ( ) ;
703
+
704
+ output . Should ( ) . BeEmpty ( ) ;
705
+ error . Should ( ) . Contain ( "Error BCP033: Expected a value of type \" int\" but the provided value is of type \" '42'\" ." ) ;
706
+ error . Should ( ) . Contain ( "Error BCP033: Expected a value of type \" string\" but the provided value is of type \" object\" ." ) ;
707
+ error . Should ( ) . Contain ( "Error BCP033: Expected a value of type \" bool\" but the provided value is of type \" <empty array>\" ." ) ;
708
+ result . Should ( ) . Be ( 1 ) ;
709
+ }
648
710
}
649
711
}
0 commit comments