コード例 #1
0
ファイル: GitHelperTest.cs プロジェクト: Qorpent/qorpent.sys
		public void CanGetDistance(){
			var githelper = new GitHelper { DirectoryName = dirname, AuthorName = "test" };
			githelper.Connect();
			var c1 = githelper.WriteAndCommit("x", "a", "message");
			var c2 = githelper.WriteAndCommit("x", "b", "message");
			var dist1 = githelper.GetDistance(c1, c2);
			Assert.AreEqual(0,dist1.Behind);
			Assert.AreEqual(1,dist1.Forward);
			Assert.True(dist1.IsForwardable);
			var dist2 = githelper.GetDistance(c2, c1);
			Assert.AreEqual(1, dist2.Behind);
			Assert.AreEqual(0, dist2.Forward);
			Assert.True(dist2.IsUpdateable);
			githelper.Checkout(c1);
			var c3 = githelper.WriteAndCommit("x", "c", "message");
			var dist3 = githelper.GetDistance(c2, c3);
			Assert.AreEqual(1, dist3.Behind);
			Assert.AreEqual(1, dist3.Forward);
			Assert.False(dist3.IsUpdateable);
			Assert.False(dist3.IsForwardable);
		}
コード例 #2
0
ファイル: GitHelperTest.cs プロジェクト: Qorpent/qorpent.sys
	    public void MergeCanBeTested(){
			var githelper = new GitHelper { DirectoryName = dirname }.Connect();
		    githelper.ExecuteCommand("branch", "x");
		    githelper.WriteAndCommit("x.txt", "xxx");
		    Assert.True(githelper.IsMerged("x", "HEAD"));
		    githelper.Checkout("x");
			githelper.WriteAndCommit("y.txt", "yyy");
		    githelper.Checkout(githelper.Branch);
			Assert.False(githelper.IsMerged("x", "HEAD"));
	    }