static (string, ObjectRepository) PushNewRemoteImpl(ObjectRepository repository, IObjectRepositoryContainer <ObjectRepository> container, Signature signature, string message) { var tempPath = RepositoryFixture.GetAvailableFolderPath(); Repository.Init(tempPath, isBare: true); repository = container.AddRepository(repository, signature, message); repository.Execute(r => r.Network.Remotes.Add("origin", tempPath)); var change = repository.With(repository.Applications[0].Pages[0], p => p.Description, "foo"); repository = container.Commit(change.Repository, signature, message); container.Push(repository.Id, "origin"); return(tempPath, repository); }
public void PushExistingRemote(ObjectRepository sample, IObjectRepositoryContainer <ObjectRepository> container, Signature signature, string message) { // Arrange var(tempPath, repository) = PushNewRemoteImpl(sample, container, signature, message); var change = repository.With(repository.Applications[0].Pages[0], p => p.Description, "bar"); repository = container.Commit(change.Repository, signature, message); // Act container.Push(repository.Id); // Assert using (var repo = new Repository(tempPath)) { var lastCommit = repo.Branches["master"].Tip; Assert.That(lastCommit.Id, Is.EqualTo(repository.CommitId)); } }