Ejemplo n.º 1
0
        public TestPatch CreateSmallPatchExample()
        {
            TestPatch testPatch = new TestPatch();
            Encoding fileEncoding = Encoding.UTF8;
            testPatch.Patch.Type = Patch.PatchType.ChangeFile;
            testPatch.Patch.Apply = true;
            testPatch.Patch.PatchHeader = "diff --git a/thisisatest.txt b/thisisatest.txt";
            testPatch.Patch.PatchIndex = "index 5e4dce2..5eb1e6f 100644";
            testPatch.Patch.FileNameA = "thisisatest.txt";
            testPatch.Patch.FileNameB = "thisisatest.txt";
            testPatch.AppendHeaderLine(testPatch.Patch.PatchHeader);
            testPatch.AppendHeaderLine(testPatch.Patch.PatchIndex);
            testPatch.AppendHeaderLine("--- a/" + testPatch.Patch.FileNameA);
            testPatch.AppendHeaderLine("+++ b/" + testPatch.Patch.FileNameB);
            testPatch.AppendDiffLine("@@ -1,2 +1,2 @@", fileEncoding);
            testPatch.AppendDiffLine(" iiiiii", fileEncoding);
            testPatch.AppendDiffLine("-ąśdkjaldskjlaksd", fileEncoding);
            testPatch.AppendDiffLine("+changed again€", fileEncoding);

            return testPatch;
        }
Ejemplo n.º 2
0
        public TestPatch CreateSmallPatchExample(bool reverse = false)
        {
            TestPatch testPatch    = new TestPatch();
            Encoding  fileEncoding = Encoding.UTF8;

            testPatch.Patch.Type  = PatchApply.Patch.PatchType.ChangeFile;
            testPatch.Patch.Apply = true;
            if (reverse)
            {
                testPatch.Patch.PatchHeader = "diff --git b/thisisatestb.txt a/thisisatesta.txt";
            }
            else
            {
                testPatch.Patch.PatchHeader = "diff --git a/thisisatesta.txt b/thisisatestb.txt";
            }

            testPatch.Patch.PatchIndex = "index 5e4dce2..5eb1e6f 100644";
            testPatch.Patch.FileNameA  = "thisisatesta.txt";
            testPatch.Patch.FileNameB  = "thisisatestb.txt";
            testPatch.AppendHeaderLine(testPatch.Patch.PatchHeader);
            testPatch.AppendHeaderLine(testPatch.Patch.PatchIndex);
            if (reverse)
            {
                testPatch.AppendHeaderLine("--- b/" + testPatch.Patch.FileNameB);
                testPatch.AppendHeaderLine("+++ a/" + testPatch.Patch.FileNameA);
            }
            else
            {
                testPatch.AppendHeaderLine("--- a/" + testPatch.Patch.FileNameA);
                testPatch.AppendHeaderLine("+++ b/" + testPatch.Patch.FileNameB);
            }

            testPatch.AppendDiffLine("@@ -1,2 +1,2 @@", fileEncoding);
            testPatch.AppendDiffLine(" iiiiii", fileEncoding);
            testPatch.AppendDiffLine("-ąśdkjaldskjlaksd", fileEncoding);
            testPatch.AppendDiffLine("+changed again€", fileEncoding);

            return(testPatch);
        }
Ejemplo n.º 3
0
        private static TestPatch CreateSmallPatchExample(bool reverse = false)
        {
            var testPatch = new TestPatch
            {
                Patch =
                {
                    Type        = Patch.PatchType.ChangeFile,
                    PatchHeader = reverse ? "diff --git b/thisisatestb.txt a/thisisatesta.txt" : "diff --git a/thisisatesta.txt b/thisisatestb.txt",
                    PatchIndex  = "index 5e4dce2..5eb1e6f 100644",
                    FileNameA   = "thisisatesta.txt",
                    FileNameB   = "thisisatestb.txt"
                }
            };

            testPatch.AppendHeaderLine(testPatch.Patch.PatchHeader);
            testPatch.AppendHeaderLine(testPatch.Patch.PatchIndex);

            if (reverse)
            {
                testPatch.AppendHeaderLine("--- b/" + testPatch.Patch.FileNameB);
                testPatch.AppendHeaderLine("+++ a/" + testPatch.Patch.FileNameA);
            }
            else
            {
                testPatch.AppendHeaderLine("--- a/" + testPatch.Patch.FileNameA);
                testPatch.AppendHeaderLine("+++ b/" + testPatch.Patch.FileNameB);
            }

            var fileEncoding = Encoding.UTF8;

            testPatch.AppendDiffLine("@@ -1,2 +1,2 @@", fileEncoding);
            testPatch.AppendDiffLine(" iiiiii", fileEncoding);
            testPatch.AppendDiffLine("-ąśdkjaldskjlaksd", fileEncoding);
            testPatch.AppendDiffLine("+changed again€", fileEncoding);

            return(testPatch);
        }