コード例 #1
0
        public void GetPixels_returns_enumerable_of_Pixel()
        {
            var rb = new RandomBitmapFactory().BuildRandomBitmap();
            WriteBitmapSpecsToConsole(rb);

            Assert.IsType<Pixel>(rb.Bitmap.GetPixels().FirstOrDefault());
        }
コード例 #2
0
        public void GetPixels_returns_all_the_pixels()
        {
            var rb = new RandomBitmapFactory().BuildRandomBitmap();
            WriteBitmapSpecsToConsole(rb);

            var totalNumberOfPixels = rb.Bitmap.Height * rb.Bitmap.Width;

            Assert.Equal(totalNumberOfPixels, rb.Bitmap.GetPixels().Count());
        }
コード例 #3
0
        public void BuildColorCount_returns_a_ColorCount()
        {
            var rb = new RandomBitmapFactory().BuildRandomBitmap();
            WriteBitmapSpecsToConsole(rb);

            ColorMap map = rb.Bitmap.BuildColorMap();

            Assert.IsAssignableFrom<Dictionary<Color, int>>(map);
            Assert.Equal(rb.Breakdown.Keys.Count, map.Keys.Count);
            rb.Breakdown.ToList().ForEach(kvp =>
            {
                Assert.True(map.Keys.Contains(kvp.Key), String.Format("expected map to contain {0} but it did not.", kvp.Key));
                Assert.Equal(kvp.Value, map[kvp.Key]);
            });
        }