public void Black_Pixel() { _bitmap.SetPixel(X1, Y1, Color.Black); WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsTrue(wb.IsPixelSet(X1, Y1)); }
public void Axes_Not_Swapped() { _bitmap.SetPixel(X1, Y1, DarkGrey); WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsFalse(wb.IsPixelSet(Y1, X1)); // Note, X and Y swapped around here. This pixel expected *NOT* to be set }
public void White_Pixel() { _bitmap.SetPixel(X1, Y1, Color.White); WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsFalse(wb.IsPixelSet(X1, Y1)); }
public void Brightness_Less_Than_128() { _bitmap.SetPixel(X1, Y1, DarkGrey); WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsTrue(wb.IsPixelSet(X1, Y1)); }
public void Brightness_Greater_Than_127() { _bitmap.SetPixel(X1, Y1, LightGrey); WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsFalse(wb.IsPixelSet(X1, Y1)); }
public void WrappedBitmap_Immutable() { WrappedBitmap wb = new WrappedBitmap(_bitmap); Assert.IsFalse(wb.IsPixelSet(X1, Y1)); _bitmap.SetPixel(X1, Y1, Color.Black); Assert.IsFalse(wb.IsPixelSet(X1, Y1)); }
public void Defers_Scoring_To_Scorer() { const int mockedScore = 555; WrappedBitmap wb = new WrappedBitmap(new Bitmap(1, 1)); _scorer.Score(null).ReturnsForAnyArgs(mockedScore); var score = _recogniser.Score(wb); _scorer.Received(1).Score(wb); Assert.AreEqual(mockedScore, score); }
public void Nonexistent_Filename_Throws() { WrappedBitmap wb = WrappedBitmap.FromFile(@"Z:\Of course, if this path actually exists on somebody's drive, the test will pass wrongly\But I think it's pretty unlikely\And am willing to take the risk\testFile.png"); // ExpectedException attribute will catch }
public void Empty_Filename_Not_Acceptable() { WrappedBitmap wb = WrappedBitmap.FromFile(""); // ExpectedException attribute will catch }
public void Null_Input_Bitmap_Not_Acceptable() { WrappedBitmap wb = new WrappedBitmap(null); // ExpectedException attribute will catch }