File tree Expand file tree Collapse file tree
source/Calamari.Tests/Fixtures/JsonVariables Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,6 +233,36 @@ public void ShouldReplaceElementInArray()
233233 var replaced = Replace ( variables , existingFile : "appsettings.array.json" ) ;
234234 AssertJsonEquivalent ( replaced , expected ) ;
235235 }
236+
237+ [ Test ]
238+ public void ShouldReplacePropertyOfAnElementInArray ( )
239+ {
240+ const string expected =
241+ "{" +
242+ " \" MyMessage\" : \" Hello world\" ," +
243+ " \" EmailSettings\" : {" +
244+ " \" SmtpPort\" : 23," +
245+ " \" UseProxy\" : false," +
246+ " \" SmtpHost\" : \" localhost\" ," +
247+ " \" DefaultRecipients\" : [" +
248+ " { " +
249+ " \" Email\" :\" paul@octopus.com\" ," +
250+ " \" Name\" : \" Paul\" " +
251+ " }," +
252+ " { " +
253+ " \" Email\" :\" henrik@octopus.com\" ," +
254+ " \" Name\" : \" Mike\" " +
255+ " }" +
256+ " ]" +
257+ " }" +
258+ "}" ;
259+
260+ var variables = new VariableDictionary ( ) ;
261+ variables . Set ( "EmailSettings:DefaultRecipients:1:Email" , "henrik@octopus.com" ) ;
262+
263+ var replaced = Replace ( variables , existingFile : "appsettings.object-array.json" ) ;
264+ AssertJsonEquivalent ( replaced , expected ) ;
265+ }
236266
237267 [ Test ]
238268 public void ShouldReplaceEntireArray ( )
Original file line number Diff line number Diff line change 1+ {
2+ "MyMessage" : " Hello world" ,
3+ "EmailSettings" : {
4+ "SmtpPort" : 23 ,
5+ "UseProxy" : false ,
6+ "SmtpHost" : " localhost" ,
7+ "DefaultRecipients" : [
8+ {
9+ "Email" : " paul@octopus.com" ,
10+ "Name" : " Paul"
11+ },
12+ {
13+ "Email" : " mike@octopus.com" ,
14+ "Name" : " Mike"
15+ }
16+ ]
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments