public void SumTest1()
{
Bitmap image = Properties.Resources.image2;
int expected = 0;
for (int i = 3; i < 9; i++)
for (int j = 2; j < 10; j++)
expected += image.GetPixel(i, j).R;
BitmapData data = image.LockBits(new Rectangle(System.Drawing.Point.Empty, image.Size),
ImageLockMode.ReadOnly, image.PixelFormat);
int actual = Tools.Sum(data, new Rectangle(3, 2, 9 - 3, 10 - 2));
Assert.AreEqual(expected, actual);
image.UnlockBits(data);
}