Пример #1
0
        public void Black_Pixel()
        {
            _bitmap.SetPixel(X1, Y1, Color.Black);
            WrappedBitmap wb = new WrappedBitmap(_bitmap);

            Assert.IsTrue(wb.IsPixelSet(X1, Y1));
        }
Пример #2
0
        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
        }
Пример #3
0
        public void White_Pixel()
        {
            _bitmap.SetPixel(X1, Y1, Color.White);
            WrappedBitmap wb = new WrappedBitmap(_bitmap);

            Assert.IsFalse(wb.IsPixelSet(X1, Y1));
        }
Пример #4
0
        public void Brightness_Less_Than_128()
        {
            _bitmap.SetPixel(X1, Y1, DarkGrey);
            WrappedBitmap wb = new WrappedBitmap(_bitmap);

            Assert.IsTrue(wb.IsPixelSet(X1, Y1));
        }
Пример #5
0
        public void Brightness_Greater_Than_127()
        {
            _bitmap.SetPixel(X1, Y1, LightGrey);
            WrappedBitmap wb = new WrappedBitmap(_bitmap);

            Assert.IsFalse(wb.IsPixelSet(X1, Y1));
        }
Пример #6
0
        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));
        }
Пример #7
0
        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);
        }
Пример #8
0
 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
 }
Пример #9
0
 public void Empty_Filename_Not_Acceptable()
 {
     WrappedBitmap wb = WrappedBitmap.FromFile("");
     // ExpectedException attribute will catch
 }
Пример #10
0
 public void Null_Input_Bitmap_Not_Acceptable()
 {
     WrappedBitmap wb = new WrappedBitmap(null);
     // ExpectedException attribute will catch
 }