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;
        }
Exemple #2
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);
        }
        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);
        }