public void ToBitmapTest1()
{
double[][] pixels =
{
new double[] { 0,0,0 }, new double[] { 0,0,1 }, new double[] { 0,1,0 },
new double[] { 0,1,1 }, new double[] { 1,0,0 }, new double[] { 1,0,1 },
new double[] { 1,1,0 }, new double[] { 1,1,1 }, new double[] { 0,0.5,0 },
};
int width = 3;
int height = 3;
double min = 0;
double max = 1;
Bitmap actual = Tools.ToBitmap(pixels, width, height, min, max);
// Accord.Controls.ImageBox.Show(actual, PictureBoxSizeMode.Zoom);
Assert.AreEqual(Color.FromArgb(000, 000, 000), actual.GetPixel(0, 0));
Assert.AreEqual(Color.FromArgb(000, 000, 255), actual.GetPixel(1, 0));
Assert.AreEqual(Color.FromArgb(000, 255, 000), actual.GetPixel(2, 0));
Assert.AreEqual(Color.FromArgb(000, 255, 255), actual.GetPixel(0, 1));
Assert.AreEqual(Color.FromArgb(255, 000, 000), actual.GetPixel(1, 1));
Assert.AreEqual(Color.FromArgb(255, 000, 255), actual.GetPixel(2, 1));
Assert.AreEqual(Color.FromArgb(255, 255, 000), actual.GetPixel(0, 2));
Assert.AreEqual(Color.FromArgb(255, 255, 255), actual.GetPixel(1, 2));
Assert.AreEqual(Color.FromArgb(000, 127, 000), actual.GetPixel(2, 2));
double[][] actualArray = actual.ToDoubleArray(min, max);
Assert.IsTrue(Matrix.IsEqual(pixels, actualArray, 0.01));
}