tests(git-provider): Add duplicated repo registration test
This commit is contained in:
parent
cf2660b6b2
commit
30e103f021
2 changed files with 28 additions and 2 deletions
|
|
@ -74,4 +74,23 @@ public class AddRegistrationTests
|
|||
|
||||
Assert.Equal("repo", whitespaceName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DuplicateRepoRegistrationShouldFail()
|
||||
{
|
||||
Settings.UseFileName(nameof(RepoRegistrationWithWhitespaceName));
|
||||
|
||||
var gitManager = GitManager.InternalFreshInstance;
|
||||
var testRepoAbsolutePath = "Test:/some/test/repo";
|
||||
string[] paths = ["test", "nested", "path"];
|
||||
var names = (NormalSeparator: string.Join(Path.DirectorySeparatorChar, paths), AltSeparator: string.Join(Path.AltDirectorySeparatorChar, paths));
|
||||
|
||||
var firstRegistration = gitManager.RegisterRepo(testRepoAbsolutePath, names.NormalSeparator);
|
||||
// TODO: make nested registrations fail in both directions and test
|
||||
var secondRegistration = gitManager.RegisterRepo(testRepoAbsolutePath, Path.Combine(paths[..1]));
|
||||
|
||||
Assert.Equal(Path.Combine(paths), firstRegistration);
|
||||
|
||||
Assert.Throws<Exception>(() => gitManager.RegisterRepo(testRepoAbsolutePath, names.AltSeparator));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue