public void PutNextRectangle_UsesPointsGeneratorOnce()
        {
            center          = new Point(5, 5);
            pointsGenerator = A.Fake <IPointsGenerator>();
            A.CallTo(() => pointsGenerator.GetPoints()).Returns(new[] { new Point(), new Point(100, 100) });
            layouter = new CircularCloudLayouter(center, pointsGenerator);

            layouter.PutNextRectangle(new Size(10, 10));
            layouter.PutNextRectangle(new Size(10, 10));

            A.CallTo(() => pointsGenerator.GetPoints()).MustHaveHappened(Repeated.Exactly.Once);
        }
        public void PutNextRectangle_UsesPointsGenerator()
        {
            center          = new Point(5, 5);
            pointsGenerator = A.Fake <IPointsGenerator>();
            layouter        = new CircularCloudLayouter(center, pointsGenerator);

            layouter.PutNextRectangle(new Size(10, 10));

            A.CallTo(() => pointsGenerator.GetPoints()).MustHaveHappened();
        }
        public void PutNextRectangle_UsesPointsFromPointsGenerator()
        {
            var points = new[] { new Point(), new Point(2, 0), new Point(0, 2) };

            center          = new Point();
            pointsGenerator = A.Fake <IPointsGenerator>();
            A.CallTo(() => pointsGenerator.GetPoints()).Returns(points);
            layouter = new CircularCloudLayouter(center, pointsGenerator);

            layouter.PutNextRectangle(new Size(1, 1));
            layouter.PutNextRectangle(new Size(1, 1));
            layouter.PutNextRectangle(new Size(1, 1));

            layouter.Rectangles.Select(rectangle => rectangle.GetCenter()).Should().BeEquivalentTo(points);
        }
Esempio n. 4
0
 public CircularCloudLayouter(Point center, IPointsGenerator pointsGenerator)
 {
     this.center      = center;
     pointsEnumerator = pointsGenerator.GetPoints().GetEnumerator();
 }