コード例 #1
0
ファイル: ModelTests.cs プロジェクト: Jeffjewett27/EChest
        public void CreateAndDeleteCommit()
        {
            string cpath = path + "\\Commits\\test.json";
            Commit c     = new Commit(new Commit[] { directory.GetCommit("init") }, directory.GetChangelog("initChild"), directory.GetVersion("initChild"),
                                      new CommitMetadata(""), "test");

            directory.CreateCommit(c);
            Assert.IsTrue(File.Exists(cpath));
            string text = File.ReadAllText(cpath);

            Assert.AreEqual(text, "{\r\n  \"Hash\": \"test\",\r\n  \"Parents\": [\r\n    \"init\"\r\n  ],\r\n  \"Changelog\": \"initChild\",\r\n  \"Version\": \"initChild\",\r\n  \"Metadata\": {}\r\n}");
            directory.DeleteCommit(c);
            Assert.IsFalse(File.Exists(cpath));
        }
コード例 #2
0
 /// <summary>
 /// Saves a Commit to the file directory
 /// </summary>
 /// <param name="commit"></param>
 public void CreateCommit(Commit commit)
 {
     directory.CreateCommit(commit);
 }