public void ExceedSize()
{
ZipExtraData zed = new ZipExtraData();
byte[] buffer = new byte[65506];
zed.AddEntry(1, buffer);
Assert.AreEqual(65510, zed.Length);
zed.AddEntry(2, new byte[21]);
Assert.AreEqual(65535, zed.Length);
bool caught = false;
try {
zed.AddEntry(3, null);
}
catch {
caught = true;
}
Assert.IsTrue(caught, "Expected an exception when max size exceeded");
Assert.AreEqual(65535, zed.Length);
zed.Delete(2);
Assert.AreEqual(65510, zed.Length);
caught = false;
try {
zed.AddEntry(2, new byte[22]);
}
catch {
caught = true;
}
Assert.IsTrue(caught, "Expected an exception when max size exceeded");
Assert.AreEqual(65510, zed.Length);
}