File tree Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Expand file tree Collapse file tree 2 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -538,27 +538,6 @@ public void DirectlyAccessingAnUnknownTreeEntryOfTheCommitReturnsNull()
538538 }
539539 }
540540
541- [ Theory ]
542- [ InlineData ( null , "x@example.com" ) ]
543- [ InlineData ( "" , "x@example.com" ) ]
544- [ InlineData ( "X" , null ) ]
545- [ InlineData ( "X" , "" ) ]
546- public void CommitWithInvalidSignatureConfigThrows ( string name , string email )
547- {
548- string repoPath = InitNewRepository ( ) ;
549- string configPath = CreateConfigurationWithDummyUser ( name , email ) ;
550- var options = new RepositoryOptions { GlobalConfigurationLocation = configPath } ;
551-
552- using ( var repo = new Repository ( 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" , new CommitOptions { AllowEmptyCommit = true } ) ) ;
559- }
560- }
561-
562541 [ Fact ]
563542 public void CanCommitWithSignatureFromConfig ( )
564543 {
Original file line number Diff line number Diff 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 , "x@example.com" ) ]
415+ [ InlineData ( "" , "x@example.com" ) ]
416+ [ InlineData ( "X" , null ) ]
417+ [ InlineData ( "X" , "" ) ]
418+ public void CannotBuildAProperSignatureFromConfigWhenFullIdentityCannotBeFoundInTheConfig ( string name , string email )
419+ {
420+ string repoPath = InitNewRepository ( ) ;
421+ string configPath = CreateConfigurationWithDummyUser ( name , email ) ;
422+ var options = new RepositoryOptions { GlobalConfigurationLocation = configPath } ;
423+
424+ using ( var repo = new Repository ( 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+ Signature signature = repo . Config . BuildSignature ( DateTimeOffset . Now ) ;
430+
431+ Assert . Null ( signature ) ;
432+ }
433+ }
412434 }
413435}
You can’t perform that action at this time.
0 commit comments