public void CanDeleteBranch() { var testPath = CloneTestRepository(_fixture.PopulatedRepositoryPath); var wrapper = new Git.GitWrapper(testPath); var createBranchResult = wrapper.NewBranch("test-branch").Result; Assert.True(createBranchResult.Success); var checkoutResult = wrapper.SetBranch("master").Result; Assert.True(checkoutResult.Success); var deleteBranchResult = wrapper.DeleteBranch("test-branch").Result; Assert.True(deleteBranchResult.Success); }
public void CanPushToRemoteRepository() { var remotePath = CloneTestRepository(_fixture.PopulatedRepositoryPath, true); var localPath = CloneTestRepository(remotePath); var localWrapper = new Git.GitWrapper(localPath); var checkoutResult = localWrapper.SetBranch("master").Result; Assert.True(checkoutResult.Success); File.WriteAllLines(Path.Combine(localPath, "new.txt"), new[] { "Hello", "World" }); Assert.True(localWrapper.AddAll().Result.Success); Assert.True(localWrapper.Commit("Added a file").Result.Success); var pushResult = localWrapper.Push().Result; Assert.True(pushResult.Success); // We can't test for the file existing in the remote repo because it is cloned as a bare repo. // So instead make a second clone and check that this gets the file that was pushed from the first one var newLocalPath = CloneTestRepository(remotePath); Assert.True(File.Exists(Path.Combine(newLocalPath, "new.txt"))); }