Skip to content

Commit 1ca6651

Browse files
committed
failing test
1 parent 2379c9d commit 1ca6651

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

GitVersionExe.Tests/GitPreparerTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,38 @@ public void UsingDynamicRepositoryWithFeatureBranchWorks()
242242
}
243243
}
244244

245+
[Test]
246+
public void UsingDynamicRepositoryWithoutTargetBranchFails()
247+
{
248+
var repoName = Guid.NewGuid().ToString();
249+
var tempPath = Path.GetTempPath();
250+
var tempDir = Path.Combine(tempPath, repoName);
251+
Directory.CreateDirectory(tempDir);
252+
253+
try
254+
{
255+
using (var mainRepositoryFixture = new EmptyRepositoryFixture(new Config()))
256+
{
257+
var commitId = mainRepositoryFixture.Repository.MakeACommit().Id.Sha;
258+
259+
var arguments = new Arguments
260+
{
261+
TargetPath = tempDir,
262+
TargetUrl = mainRepositoryFixture.RepositoryPath,
263+
CommitId = commitId
264+
};
265+
266+
var gitPreparer = new GitPreparer(arguments.TargetUrl, arguments.DynamicRepositoryLocation, arguments.Authentication, arguments.TargetBranch, arguments.NoFetch, arguments.TargetPath);
267+
gitPreparer.Initialise(true);
268+
269+
Assert.Throws<MissingBranchException>(() => gitPreparer.Initialise(true));
270+
}
271+
}
272+
finally
273+
{
274+
Directory.Delete(tempDir, true);
275+
}
276+
}
277+
245278
// TODO test around normalisation
246279
}

0 commit comments

Comments
 (0)