public void TestDrawRgbColorMatrix() { // init three matrices double[,] redM = new double[5, 5]; double[,] grnM = new double[5, 5]; double[,] bluM = new double[5, 5]; //convert some values to null or NaN redM[1, 1] = double.NaN; grnM[1, 1] = double.NaN; bluM[1, 1] = double.NaN; redM[2, 2] = 1.0; grnM[2, 2] = 1.0; bluM[2, 2] = double.NaN; redM[3, 3] = 0.01; grnM[3, 3] = 0.01; bluM[3, 3] = 0.11; var blueEnhanceParameter = 0.0; var image = (Bitmap)LDSpectrogramRGB.DrawRgbColorMatrix(redM, grnM, bluM, doReverseColor: true, blueEnhanceParameter); Assert.That.PixelIsColor(new Point(1, 1), Color.FromArgb(128, 128, 128), image); Assert.That.PixelIsColor(new Point(2, 2), Color.FromArgb(128, 128, 128), image); // empty values are rendered as white because of `doReverseColour` Assert.That.ImageRegionIsColor(Rectangle.FromLTRB(0, 0, 1, 5), Color.FromArgb(255, 255, 255), image); Assert.That.ImageRegionIsColor(Rectangle.FromLTRB(4, 0, 5, 5), Color.FromArgb(255, 255, 255), image); }