|
4 | 4 | using NUnit.Framework;
|
5 | 5 | using Shouldly;
|
6 | 6 | using System;
|
| 7 | +using System.Collections.Generic; |
7 | 8 | using System.IO;
|
8 | 9 | using System.Linq;
|
9 | 10 | using System.Reflection;
|
@@ -362,4 +363,71 @@ public void WarnOnObsoleteIsDevelopBranchConfigurationSetting()
|
362 | 363 | const string expectedMessage = @"'is-develop' is deprecated, use 'tracks-release-branches' instead.";
|
363 | 364 | exception.Message.ShouldContain(expectedMessage);
|
364 | 365 | }
|
| 366 | + |
| 367 | + [Test] |
| 368 | + public void ShouldUseSpecifiedSourceBranchesForDevelop() |
| 369 | + { |
| 370 | + var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 371 | + const string text = @" |
| 372 | +next-version: 2.0.0 |
| 373 | +branches: |
| 374 | + develop: |
| 375 | + mode: ContinuousDeployment |
| 376 | + source-branches: ['develop'] |
| 377 | + tag: dev"; |
| 378 | + SetupConfigFileContent(text); |
| 379 | + var config = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 380 | + |
| 381 | + config.Branches["develop"].SourceBranches.ShouldBe(new List<string> { "develop" }); |
| 382 | + } |
| 383 | + |
| 384 | + [Test] |
| 385 | + public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop() |
| 386 | + { |
| 387 | + var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 388 | + const string text = @" |
| 389 | +next-version: 2.0.0 |
| 390 | +branches: |
| 391 | + develop: |
| 392 | + mode: ContinuousDeployment |
| 393 | + tag: dev"; |
| 394 | + SetupConfigFileContent(text); |
| 395 | + var config = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 396 | + |
| 397 | + config.Branches["develop"].SourceBranches.ShouldBe(new List<string>()); |
| 398 | + } |
| 399 | + |
| 400 | + [Test] |
| 401 | + public void ShouldUseSpecifiedSourceBranchesForFeature() |
| 402 | + { |
| 403 | + var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 404 | + const string text = @" |
| 405 | +next-version: 2.0.0 |
| 406 | +branches: |
| 407 | + feature: |
| 408 | + mode: ContinuousDeployment |
| 409 | + source-branches: ['develop', 'release'] |
| 410 | + tag: dev"; |
| 411 | + SetupConfigFileContent(text); |
| 412 | + var config = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 413 | + |
| 414 | + config.Branches["feature"].SourceBranches.ShouldBe(new List<string> { "develop", "release" }); |
| 415 | + } |
| 416 | + |
| 417 | + [Test] |
| 418 | + public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature() |
| 419 | + { |
| 420 | + var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 421 | + const string text = @" |
| 422 | +next-version: 2.0.0 |
| 423 | +branches: |
| 424 | + feature: |
| 425 | + mode: ContinuousDeployment |
| 426 | + tag: dev"; |
| 427 | + SetupConfigFileContent(text); |
| 428 | + var config = ConfigurationProvider.Provide(repoPath, fileSystem); |
| 429 | + |
| 430 | + config.Branches["feature"].SourceBranches.ShouldBe( |
| 431 | + new List<string> { "develop", "master", "release", "feature", "support", "hotfix" }); |
| 432 | + } |
365 | 433 | }
|
0 commit comments