blob: 1f19ce15345e55668d0f284198b729181bc9718b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
using LibGit2Sharp.Tests.TestHelpers;
using NUnit.Framework;
namespace LibGit2Sharp.Tests
{
[TestFixture]
public class RemoteFixture : BaseFixture
{
[Test]
public void CanGetRemoteOrigin()
{
using (var repo = new Repository(StandardTestRepoPath))
{
Remote origin = repo.Remotes["origin"];
origin.ShouldNotBeNull();
origin.Name.ShouldEqual("origin");
origin.Url.ShouldEqual("c:/GitHub/libgit2sharp/Resources/testrepo.git");
}
}
[Test]
public void GettingRemoteThatDoesntExistReturnsNull()
{
using (var repo = new Repository(StandardTestRepoPath))
{
repo.Remotes["test"].ShouldBeNull();
}
}
[Test]
public void CanEnumerateTheRemotes()
{
using (var repo = new Repository(StandardTestRepoPath))
{
int count = 0;
foreach (Remote remote in repo.Remotes)
{
remote.ShouldNotBeNull();
count++;
}
count.ShouldEqual(1);
}
}
[Test]
public void CanCheckEqualityOfRemote()
{
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoPath);
using (var repo = new Repository(path.RepositoryPath))
{
Remote oneOrigin = repo.Remotes["origin"];
oneOrigin.ShouldNotBeNull();
Remote otherOrigin = repo.Remotes["origin"];
otherOrigin.ShouldEqual(oneOrigin);
Remote createdRemote = repo.Remotes.Create("origin2", oneOrigin.Url);
Remote loadedRemote = repo.Remotes["origin2"];
loadedRemote.ShouldNotBeNull();
loadedRemote.ShouldEqual(createdRemote);
loadedRemote.ShouldNotEqual(oneOrigin);
}
}
}
}
|