Skip to content

Commit 522fbad

Browse files
committed
Adding unit tests that demonstrate a problem
1 parent 1cb40da commit 522fbad

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

LibGit2Sharp.Tests/RepositoryFixture.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,5 +348,32 @@ public void DiscoverReturnsNullWhenNoRepoCanBeFound()
348348

349349
File.Delete(path);
350350
}
351+
352+
[Test]
353+
public void CanSetARemote()
354+
{
355+
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
356+
using (var repo = Repository.Init(scd.DirectoryPath, true))
357+
{
358+
repo.Config.Set("remote.origin.url", "http://example.com");
359+
360+
repo.Config.Get<string>("remote", "origin", "url", null).ShouldEqual("http://example.com");
361+
repo.Remotes["origin"].ShouldEqual("http://example.com");
362+
}
363+
}
364+
365+
[Test]
366+
public void SettingARemoteSavesIt()
367+
{
368+
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
369+
using (var repo = Repository.Init(scd.DirectoryPath, true))
370+
{
371+
repo.Config.Set("remote.origin.url", "http://example.com");
372+
373+
var newRepo = new Repository(repo.Info.Path);
374+
newRepo.Config.Get<string>("remote", "origin", "url", null).ShouldEqual("http://example.com");
375+
newRepo.Remotes["origin"].ShouldEqual("http://example.com");
376+
}
377+
}
351378
}
352379
}

0 commit comments

Comments
 (0)