public void GetAverageOfRGB_ARGB_ReturnsAverageRGB() { CustomImage cImage = new CustomImage(); int a = 255; int r = 100; int g = 150; int b = 200; int pixel = (a << 24) | (r << 16) | (g << 8) | b; int avgRGB = cImage.GetAverageOfRGB(pixel); Assert.AreEqual(150, avgRGB); }
public void ConvertColorToGreyscalImage_ColorImage_ReturnsGreyScaleImage() { CustomImage cImage = new CustomImage(); int a = 255; int r = 100; int g = 150; int b = 200; int pixel = (a << 24) | (r << 16) | (g << 8) | b; int avgRGB = cImage.GetAverageOfRGB(pixel); int greyScalePixel = cImage.ConvertColorToGreyScalePixel(pixel); int avgRGB2 = (greyScalePixel) & 0xff; Assert.AreEqual(avgRGB2, avgRGB); Assert.AreEqual(-6908266, greyScalePixel); }