Ejemplo n.º 1
0
        public void ShouldUndoChanges(int numberOfChangesToUndo)
        {
            //Given
            PaintingMediator paint = new PaintingMediator();
            CanvasBackService canvasService = new CanvasBackService();
            Canvas canvasNode = new Canvas();

            canvasService.SetCanvas(canvasNode);
            paint.SetCanvasService(canvasService);

            for (int i = 0; i < numberOfChangesToUndo; i++)
            {
                paint.Rotate(90);
            }

            //When
            for (int i = 0; i < numberOfChangesToUndo; i++)
            {
                paint.Undo();
            }

            //Then
            int expectedNumberOfChangesOnStack = 0;
            Assert.AreEqual(expectedNumberOfChangesOnStack, paint.GetNumberOfDoneChanges());
        }
Ejemplo n.º 2
0
        public void ShouldRotateCanvas(int degrees)
        {
            //Given
            PaintingMediator paint = new PaintingMediator();
            CanvasBackService canvasService = new CanvasBackService();
            Canvas canvasNode = new Canvas();

            canvasService.SetCanvas(canvasNode);
            paint.SetCanvasService(canvasService);

            //When
            paint.Rotate(degrees);

            //Then

            Assert.AreEqual(canvasNode.Height, canvasNode.Width);
            Assert.AreEqual(canvasNode.Width, canvasNode.Height);
        }