Exemplo n.º 1
0
        public void TestAppendTextLine()
        {
            Patch patch = new Patch();

            patch.AppendTextLine("text1");
            patch.AppendTextLine("text2");
            patch.AppendTextLine("text3");

            var expected = "text1\ntext2\ntext3\n";

            Assert.AreEqual(expected, patch.Text);
        }
Exemplo n.º 2
0
        public void TestLoadPatch()
        {
            PatchManager manager = NewManager();

            Patch expectedPatch = new Patch();

            expectedPatch.Type        = Patch.PatchType.ChangeFile;
            expectedPatch.Apply       = true;
            expectedPatch.PatchHeader = "diff --git a/thisisatest.txt b/thisisatest.txt";
            expectedPatch.PatchIndex  = "index 5e4dce2..5eb1e6f 100644";
            expectedPatch.FileNameA   = "thisisatest.txt";
            expectedPatch.FileNameB   = "thisisatest.txt";
            expectedPatch.AppendTextLine(expectedPatch.PatchHeader);
            expectedPatch.AppendTextLine(expectedPatch.PatchIndex);
            expectedPatch.AppendTextLine("--- a/thisisatest.txt");
            expectedPatch.AppendTextLine("+++ b/thisisatest.txt");
            expectedPatch.AppendTextLine("@@ -1,2 +1,2 @@");
            expectedPatch.AppendTextLine("iiiiii");
            expectedPatch.AppendTextLine("-asdkjaldskjlaksd");
            expectedPatch.AppendTextLine("+changed again");

            manager.LoadPatch(expectedPatch.Text, false);

            Patch createdPatch = manager.Patches.First();

            Assert.AreEqual(expectedPatch.Text, createdPatch.Text);
        }
Exemplo n.º 3
0
 public void AppendDiffLine(string line, Encoding fileEncoding)
 {
     Patch.AppendTextLine(line);
     PatchOutput.Append(GitModule.ReEncodeString(line, fileEncoding, GitModule.LosslessEncoding));
     PatchOutput.Append("\n");
 }
Exemplo n.º 4
0
 public void AppendHeaderLine(string line)
 {
     Patch.AppendTextLine(line);
     PatchOutput.Append(GitModule.ReEncodeString(line, GitModule.SystemEncoding, GitModule.LosslessEncoding));
     PatchOutput.Append("\n");
 }
Exemplo n.º 5
0
 public void AppendDiffLine(string line, Encoding fileEncoding)
 {
     Patch.AppendTextLine(line);
     PatchOutput.AppendLine(GitCommandHelpers.ReEncodeString(line, fileEncoding, Settings.LosslessEncoding));
 }
Exemplo n.º 6
0
 public void AppendHeaderLine(string line)
 {
     Patch.AppendTextLine(line);
     PatchOutput.AppendLine(GitCommandHelpers.ReEncodeString(line, Settings.SystemEncoding, Settings.LosslessEncoding));
 }