GetSize() public method

public GetSize ( ) : int
return int
        public virtual void TestParse_GitBinaryDelta()
        {
            NGit.Patch.Patch p = ParseTestPatchFile();
            NUnit.Framework.Assert.AreEqual(1, p.GetFiles().Count);
            NUnit.Framework.Assert.IsTrue(p.GetErrors().IsEmpty());
            FileHeader fh = p.GetFiles()[0];

            NUnit.Framework.Assert.IsTrue(fh.GetNewPath().StartsWith("zero.bin"));
            NUnit.Framework.Assert.AreEqual(DiffEntry.ChangeType.MODIFY, fh.GetChangeType());
            NUnit.Framework.Assert.AreEqual(FileHeader.PatchType.GIT_BINARY, fh.GetPatchType(
                                                ));
            NUnit.Framework.Assert.AreSame(FileMode.REGULAR_FILE, fh.GetNewMode());
            NUnit.Framework.Assert.IsNotNull(fh.GetOldId());
            NUnit.Framework.Assert.IsNotNull(fh.GetNewId());
            NUnit.Framework.Assert.AreEqual("08e7df176454f3ee5eeda13efa0adaa54828dfd8", fh.GetOldId
                                                ().Name);
            NUnit.Framework.Assert.AreEqual("d70d8710b6d32ff844af0ee7c247e4b4b051867f", fh.GetNewId
                                                ().Name);
            NUnit.Framework.Assert.IsTrue(fh.GetHunks().IsEmpty());
            NUnit.Framework.Assert.IsFalse(fh.HasMetaDataChanges());
            BinaryHunk fwd = fh.GetForwardBinaryHunk();
            BinaryHunk rev = fh.GetReverseBinaryHunk();

            NUnit.Framework.Assert.IsNotNull(fwd);
            NUnit.Framework.Assert.IsNotNull(rev);
            NUnit.Framework.Assert.AreEqual(12, fwd.GetSize());
            NUnit.Framework.Assert.AreEqual(11, rev.GetSize());
            NUnit.Framework.Assert.AreSame(fh, fwd.GetFileHeader());
            NUnit.Framework.Assert.AreSame(fh, rev.GetFileHeader());
            NUnit.Framework.Assert.AreEqual(BinaryHunk.Type.DELTA_DEFLATED, fwd.GetType());
            NUnit.Framework.Assert.AreEqual(BinaryHunk.Type.DELTA_DEFLATED, rev.GetType());
            NUnit.Framework.Assert.AreEqual(496, fh.endOffset);
        }
        public virtual void TestParse_GitBinaryLiteral()
        {
            NGit.Patch.Patch p        = ParseTestPatchFile();
            int[]            binsizes = new int[] { 359, 393, 372, 404 };
            NUnit.Framework.Assert.AreEqual(5, p.GetFiles().Count);
            NUnit.Framework.Assert.IsTrue(p.GetErrors().IsEmpty());
            for (int i = 0; i < 4; i++)
            {
                FileHeader fh = p.GetFiles()[i];
                NUnit.Framework.Assert.AreEqual(DiffEntry.ChangeType.ADD, fh.GetChangeType());
                NUnit.Framework.Assert.IsNotNull(fh.GetOldId());
                NUnit.Framework.Assert.IsNotNull(fh.GetNewId());
                NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId.Name, fh.GetOldId().Name);
                NUnit.Framework.Assert.AreSame(FileMode.REGULAR_FILE, fh.GetNewMode());
                NUnit.Framework.Assert.IsTrue(fh.GetNewPath().StartsWith("org.spearce.egit.ui/icons/toolbar/"
                                                                         ));
                NUnit.Framework.Assert.AreEqual(FileHeader.PatchType.GIT_BINARY, fh.GetPatchType(
                                                    ));
                NUnit.Framework.Assert.IsTrue(fh.GetHunks().IsEmpty());
                NUnit.Framework.Assert.IsTrue(fh.HasMetaDataChanges());
                BinaryHunk fwd = fh.GetForwardBinaryHunk();
                BinaryHunk rev = fh.GetReverseBinaryHunk();
                NUnit.Framework.Assert.IsNotNull(fwd);
                NUnit.Framework.Assert.IsNotNull(rev);
                NUnit.Framework.Assert.AreEqual(binsizes[i], fwd.GetSize());
                NUnit.Framework.Assert.AreEqual(0, rev.GetSize());
                NUnit.Framework.Assert.AreSame(fh, fwd.GetFileHeader());
                NUnit.Framework.Assert.AreSame(fh, rev.GetFileHeader());
                NUnit.Framework.Assert.AreEqual(BinaryHunk.Type.LITERAL_DEFLATED, fwd.GetType());
                NUnit.Framework.Assert.AreEqual(BinaryHunk.Type.LITERAL_DEFLATED, rev.GetType());
            }
            FileHeader fh_1 = p.GetFiles()[4];

            NUnit.Framework.Assert.AreEqual("org.spearce.egit.ui/plugin.xml", fh_1.GetNewPath
                                                ());
            NUnit.Framework.Assert.AreEqual(DiffEntry.ChangeType.MODIFY, fh_1.GetChangeType()
                                            );
            NUnit.Framework.Assert.AreEqual(FileHeader.PatchType.UNIFIED, fh_1.GetPatchType()
                                            );
            NUnit.Framework.Assert.IsFalse(fh_1.HasMetaDataChanges());
            NUnit.Framework.Assert.AreEqual("ee8a5a0", fh_1.GetNewId().Name);
            NUnit.Framework.Assert.IsNull(fh_1.GetForwardBinaryHunk());
            NUnit.Framework.Assert.IsNull(fh_1.GetReverseBinaryHunk());
            NUnit.Framework.Assert.AreEqual(1, fh_1.GetHunks().Count);
            NUnit.Framework.Assert.AreEqual(272, fh_1.GetHunks()[0].GetOldImage().GetStartLine
                                                ());
        }