@@ -200,28 +200,7 @@ public void UsesFirstBranchConfigWhenMultipleMatch(string branchName, IncrementS
200
200
}
201
201
202
202
[ Test ]
203
- public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_configuaration_without_increment_Then_result_should_be_empty ( )
204
- {
205
- // Arrange
206
- var branchMock = GitToolsTestingExtensions . CreateMockBranch ( "develop" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
207
- var configuration = GitFlowConfigurationBuilder . New
208
- . WithIncrement ( null )
209
- . WithBranch ( "develop" , builder => builder . WithIncrement ( IncrementStrategy . Inherit ) )
210
- . Build ( ) ;
211
- var repositoryStoreMock = Substitute . For < IRepositoryStore > ( ) ;
212
- repositoryStoreMock . GetSourceBranches ( branchMock , configuration , Arg . Any < HashSet < IBranch > > ( ) ) . Returns ( Enumerable . Empty < IBranch > ( ) ) ;
213
-
214
- var unitUnderTest = new EffectiveBranchConfigurationFinder ( Substitute . For < ILog > ( ) , repositoryStoreMock ) ;
215
-
216
- // Act
217
- var actual = unitUnderTest . GetConfigurations ( branchMock , configuration ) . ToArray ( ) ;
218
-
219
- // Assert
220
- actual . ShouldBeEmpty ( ) ;
221
- }
222
-
223
- [ Test ]
224
- public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_configuration_with_increment_inherit_Then_result_should_have_increment_none ( )
203
+ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_configuration_with_increment_inherit_Then_result_should_be_empty ( )
225
204
{
226
205
// Arrange
227
206
var branchMock = GitToolsTestingExtensions . CreateMockBranch ( "develop" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
@@ -238,9 +217,7 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con
238
217
var actual = unitUnderTest . GetConfigurations ( branchMock , configuration ) . ToArray ( ) ;
239
218
240
219
// Assert
241
- actual . ShouldHaveSingleItem ( ) ;
242
- actual [ 0 ] . Branch . ShouldBe ( branchMock ) ;
243
- actual [ 0 ] . Value . Increment . ShouldBe ( IncrementStrategy . None ) ;
220
+ actual . ShouldBeEmpty ( ) ;
244
221
}
245
222
246
223
[ TestCase ( IncrementStrategy . None ) ]
@@ -271,12 +248,13 @@ public void When_getting_configurations_of_an_orphaned_branch_Given_fallback_con
271
248
}
272
249
273
250
[ Test ]
274
- public void When_getting_configurations_of_an_unknown_branch_Given_fallback_configuaration_without_increment_and_unknown_configuration_with_increment_inherit_Then_result_should_be_empty ( )
251
+ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_and_unknown_configuration_with_increment_inherit_Then_result_should_be_empty ( )
275
252
{
276
253
// Arrange
277
254
var branchMock = GitToolsTestingExtensions . CreateMockBranch ( "unknown" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
278
255
var configuration = GitFlowConfigurationBuilder . New
279
- . WithIncrement ( null )
256
+ . WithIncrement ( IncrementStrategy . Inherit )
257
+ . WithBranch ( "unknown" , builder => builder . WithIncrement ( IncrementStrategy . Inherit ) )
280
258
. Build ( ) ;
281
259
var repositoryStoreMock = Substitute . For < IRepositoryStore > ( ) ;
282
260
repositoryStoreMock . GetSourceBranches ( branchMock , configuration , Arg . Any < HashSet < IBranch > > ( ) ) . Returns ( Enumerable . Empty < IBranch > ( ) ) ;
@@ -301,6 +279,7 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf
301
279
var branchMock = GitToolsTestingExtensions . CreateMockBranch ( "unknown" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
302
280
var configuration = GitFlowConfigurationBuilder . New
303
281
. WithIncrement ( fallbackIncrement )
282
+ . WithBranch ( "unknown" , builder => builder . WithIncrement ( IncrementStrategy . Inherit ) )
304
283
. Build ( ) ;
305
284
var repositoryStoreMock = Substitute . For < IRepositoryStore > ( ) ;
306
285
repositoryStoreMock . GetSourceBranches ( branchMock , configuration , Arg . Any < HashSet < IBranch > > ( ) ) . Returns ( Enumerable . Empty < IBranch > ( ) ) ;
@@ -318,13 +297,13 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf
318
297
319
298
[ Theory ]
320
299
public void When_getting_configurations_of_an_unknown_branch_Given_fallback_configuaration_with_increment_and_develop_branch_with_increment_Then_result_should_have_develop_increment (
321
- IncrementStrategy fallbackIncrement , IncrementStrategy developBranchIncrement )
300
+ IncrementStrategy fallbackIncrement , IncrementStrategy developIncrement )
322
301
{
323
302
// Arrange
324
303
var unknownBranchMock = GitToolsTestingExtensions . CreateMockBranch ( "unknown" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
325
304
var configuration = GitFlowConfigurationBuilder . New
326
305
. WithIncrement ( fallbackIncrement )
327
- . WithBranch ( "develop" , builder => builder . WithIncrement ( developBranchIncrement ) )
306
+ . WithBranch ( "develop" , builder => builder . WithIncrement ( developIncrement ) )
328
307
. Build ( ) ;
329
308
var repositoryStoreMock = Substitute . For < IRepositoryStore > ( ) ;
330
309
var developBranchMock = GitToolsTestingExtensions . CreateMockBranch ( "develop" , GitToolsTestingExtensions . CreateMockCommit ( ) ) ;
@@ -336,22 +315,24 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf
336
315
var actual = unitUnderTest . GetConfigurations ( unknownBranchMock , configuration ) . ToArray ( ) ;
337
316
338
317
// Assert
339
- actual . ShouldHaveSingleItem ( ) ;
340
- actual [ 0 ] . Branch . ShouldBe ( developBranchMock ) ;
341
-
342
- if ( developBranchIncrement == IncrementStrategy . Inherit )
318
+ if ( fallbackIncrement == IncrementStrategy . Inherit && developIncrement == IncrementStrategy . Inherit )
343
319
{
344
- if ( fallbackIncrement == IncrementStrategy . Inherit )
345
- {
346
- fallbackIncrement = IncrementStrategy . None ;
347
- }
348
- actual [ 0 ] . Value . Increment . ShouldBe ( fallbackIncrement ) ;
320
+ actual . ShouldBeEmpty ( ) ;
349
321
}
350
322
else
351
323
{
352
- actual [ 0 ] . Value . Increment . ShouldBe ( developBranchIncrement ) ;
353
- }
324
+ actual . ShouldHaveSingleItem ( ) ;
325
+ actual [ 0 ] . Branch . ShouldBe ( developBranchMock ) ;
354
326
327
+ if ( developIncrement == IncrementStrategy . Inherit )
328
+ {
329
+ actual [ 0 ] . Value . Increment . ShouldBe ( fallbackIncrement ) ;
330
+ }
331
+ else
332
+ {
333
+ actual [ 0 ] . Value . Increment . ShouldBe ( developIncrement ) ;
334
+ }
335
+ }
355
336
}
356
337
357
338
[ Theory ]
@@ -374,14 +355,16 @@ public void When_getting_configurations_of_an_unknown_branch_Given_fallback_conf
374
355
var actual = unitUnderTest . GetConfigurations ( unknownBranchMock , configuration ) . ToArray ( ) ;
375
356
376
357
// Assert
377
- actual . ShouldHaveSingleItem ( ) ;
378
- actual [ 0 ] . Branch . ShouldBe ( developBranchMock ) ;
379
-
380
358
if ( fallbackIncrement == IncrementStrategy . Inherit )
381
359
{
382
- fallbackIncrement = IncrementStrategy . None ;
360
+ actual . ShouldBeEmpty ( ) ;
361
+ }
362
+ else
363
+ {
364
+ actual . ShouldHaveSingleItem ( ) ;
365
+ actual [ 0 ] . Branch . ShouldBe ( developBranchMock ) ;
366
+ actual [ 0 ] . Value . Increment . ShouldBe ( fallbackIncrement ) ;
383
367
}
384
- actual [ 0 ] . Value . Increment . ShouldBe ( fallbackIncrement ) ;
385
368
}
386
369
387
370
[ TestCase ( IncrementStrategy . None ) ]
0 commit comments