diff --git a/tests/ModuleTests/Git/AddRegistrationTests.cs b/tests/ModuleTests/Git/AddRegistrationTests.cs index 0597e61..6de31d6 100644 --- a/tests/ModuleTests/Git/AddRegistrationTests.cs +++ b/tests/ModuleTests/Git/AddRegistrationTests.cs @@ -33,4 +33,45 @@ public class AddRegistrationTests 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); + } } \ No newline at end of file