tests(git-provider): Add fact tests for empty name registrations
This commit is contained in:
parent
09236e826a
commit
cf2660b6b2
1 changed files with 41 additions and 0 deletions
|
|
@ -33,4 +33,45 @@ public class AddRegistrationTests
|
||||||
|
|
||||||
return Verify(sb, Settings);
|
return Verify(sb, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void RepoRegistrationWithEmptyName()
|
||||||
|
{
|
||||||
|
Settings.UseFileName(nameof(RepoRegistrationWithEmptyName));
|
||||||
|
|
||||||
|
var gitManager = GitManager.InternalFreshInstance;
|
||||||
|
var testRepoAbsolutePath = "Test:/some/test/repo";
|
||||||
|
|
||||||
|
var emptyName = gitManager.RegisterRepo(testRepoAbsolutePath, "");
|
||||||
|
|
||||||
|
Assert.Equal("repo", emptyName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void RepoRegistrationWithNullName()
|
||||||
|
{
|
||||||
|
Settings.UseFileName(nameof(RepoRegistrationWithNullName));
|
||||||
|
|
||||||
|
var gitManager = GitManager.InternalFreshInstance;
|
||||||
|
var testRepoAbsolutePath = "Test:/some/test/repo";
|
||||||
|
|
||||||
|
// Name is technically not-nullable, but string is a reference type so null can be passed in so we should test
|
||||||
|
// it regardless
|
||||||
|
var nullName = gitManager.RegisterRepo(testRepoAbsolutePath, null!);
|
||||||
|
|
||||||
|
Assert.Equal("repo", nullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void RepoRegistrationWithWhitespaceName()
|
||||||
|
{
|
||||||
|
Settings.UseFileName(nameof(RepoRegistrationWithWhitespaceName));
|
||||||
|
|
||||||
|
var gitManager = GitManager.InternalFreshInstance;
|
||||||
|
var testRepoAbsolutePath = "Test:/some/test/repo";
|
||||||
|
|
||||||
|
var whitespaceName = gitManager.RegisterRepo(testRepoAbsolutePath, " ");
|
||||||
|
|
||||||
|
Assert.Equal("repo", whitespaceName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue