public void CreateGitRepository() { string dir = GetTempPath(); string file = Path.Combine(dir, "file"); using (GitRepository repo = GitRepository.Create(dir)) { Assert.That(repo, Is.Not.Null); Assert.That(repo.IsEmpty, Is.True); Assert.That(repo.IsBare, Is.False); Assert.That(repo.RepositoryDirectory, Is.EqualTo(Path.Combine(dir, GitClient.AdministrativeDirectoryName))); Assert.That(repo.WorkingCopyDirectory, Is.EqualTo(dir)); GitConfiguration config = repo.Configuration; Assert.That(config, Is.Not.Null); GitIndex index = repo.Index; Assert.That(index, Is.Not.Null); //repo.SetIndex(index); GitObjectDatabase odb = repo.ObjectDatabase; Assert.That(odb, Is.Not.Null); //repo.SetObjectDatabase(odb); File.WriteAllText(file, "qqq"); repo.Index.Add("file"); Assert.That(repo.Configuration.Set(GitConfigurationLevel.Repository, GitConfigurationKeys.UserName, "Tester")); Assert.That(repo.Configuration.Set(GitConfigurationLevel.Repository, GitConfigurationKeys.UserEmail, "[email protected]")); string v; Assert.That(repo.Configuration.TryGetString(GitConfigurationKeys.UserName, out v)); Assert.That(v, Is.EqualTo("Tester")); Assert.That(repo.Configuration.TryGetString(GitConfigurationKeys.UserEmail, out v)); Assert.That(v, Is.EqualTo("[email protected]")); Assert.That(index.Contains("file")); GitIndexEntry entry = repo.Index["file"]; Assert.That(entry, Is.Not.Null); Assert.That(entry.FileSize, Is.EqualTo(3)); Assert.That(entry.Id, Is.EqualTo(new GitId("E5A49F32170B89EE4425C4AB09E70DFCDB93E174"))); index.Reload(); Assert.That(index.Contains("file"), Is.False); } }