Skip to content

Commit 1e79a42

Browse files
committed
Enforce Configuration.BuildSignature test coverage
1 parent f211cbc commit 1e79a42

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

‎LibGit2Sharp.Tests/CommitFixture.cs‎

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -538,27 +538,6 @@ public void DirectlyAccessingAnUnknownTreeEntryOfTheCommitReturnsNull()
538538
}
539539
}
540540

541-
[Theory]
542-
[InlineData(null,"[email protected]")]
543-
[InlineData("","[email protected]")]
544-
[InlineData("X",null)]
545-
[InlineData("X","")]
546-
publicvoidCommitWithInvalidSignatureConfigThrows(stringname,stringemail)
547-
{
548-
stringrepoPath=InitNewRepository();
549-
stringconfigPath=CreateConfigurationWithDummyUser(name,email);
550-
varoptions=newRepositoryOptions{GlobalConfigurationLocation=configPath};
551-
552-
using(varrepo=newRepository(repoPath,options))
553-
{
554-
Assert.Equal(name,repo.Config.GetValueOrDefault<string>("user.name"));
555-
Assert.Equal(email,repo.Config.GetValueOrDefault<string>("user.email"));
556-
557-
Assert.Throws<LibGit2SharpException>(
558-
()=>repo.Commit("Initial egotistic commit",newCommitOptions{AllowEmptyCommit=true}));
559-
}
560-
}
561-
562541
[Fact]
563542
publicvoidCanCommitWithSignatureFromConfig()
564543
{

‎LibGit2Sharp.Tests/ConfigurationFixture.cs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,5 +409,27 @@ public void PassingANonExistingLocalConfigurationFileToBuildFromthrowss()
409409
Assert.Throws<FileNotFoundException>(()=>Configuration.BuildFrom(
410410
Path.Combine(Path.GetTempPath(),Path.GetRandomFileName())));
411411
}
412+
413+
[Theory]
414+
[InlineData(null,"[email protected]")]
415+
[InlineData("","[email protected]")]
416+
[InlineData("X",null)]
417+
[InlineData("X","")]
418+
publicvoidCannotBuildAProperSignatureFromConfigWhenFullIdentityCannotBeFoundInTheConfig(stringname,stringemail)
419+
{
420+
stringrepoPath=InitNewRepository();
421+
stringconfigPath=CreateConfigurationWithDummyUser(name,email);
422+
varoptions=newRepositoryOptions{GlobalConfigurationLocation=configPath};
423+
424+
using(varrepo=newRepository(repoPath,options))
425+
{
426+
Assert.Equal(name,repo.Config.GetValueOrDefault<string>("user.name"));
427+
Assert.Equal(email,repo.Config.GetValueOrDefault<string>("user.email"));
428+
429+
Signaturesignature=repo.Config.BuildSignature(DateTimeOffset.Now);
430+
431+
Assert.Null(signature);
432+
}
433+
}
412434
}
413435
}

0 commit comments

Comments
(0)