コード例 #1
0
        public void Write_OneRectangle()
        {
            var bitmap = TagsCloudBitmapWriter
                         .Write(new List <Rectangle> {
                new Rectangle(0, 0, 100, 37)
            });

            bitmap.Width.Should().Be(100);
            bitmap.Height.Should().Be(37);
        }
コード例 #2
0
        public void TearDown()
        {
            var context = TestContext.CurrentContext;

            if (context.Result.Status == TestStatus.Failed)
            {
                var fileName = $"{context.Test.Name}_{DateTime.Now:yy-MM-dd-HH-mm-ss}.bmp";
                TagsCloudBitmapWriter.Write(layouter.Rectangles).Save(fileName, ImageFormat.Bmp);
                Assert.Fail($"Test's layout saved to {fileName}");
            }
        }
コード例 #3
0
        public void HasNoEffectOnInitialCollection()
        {
            var rectangles = new List <Rectangle>
            {
                new Rectangle(-100, -50, 10, 20),
                new Rectangle(43, 70, 5, 6)
            };

            TagsCloudBitmapWriter.Write(rectangles);
            rectangles.Should().Equal(rectangles);
        }
コード例 #4
0
        public void ShiftToPositiveCoordinates()
        {
            var bitmap = TagsCloudBitmapWriter
                         .Write(new List <Rectangle>
            {
                new Rectangle(-100, -50, 10, 20),
                new Rectangle(43, 70, 5, 6)
            });

            bitmap.Width.Should().Be(148);
            bitmap.Height.Should().Be(126);
        }
コード例 #5
0
        public void ThrowException_NoRectangles()
        {
            Action writeAction = () => TagsCloudBitmapWriter.Write(new List <Rectangle>());

            writeAction.ShouldThrow <ArgumentException>();
        }