Example #1
0
 public void TestHandleCanvasLeftMousePressed()
 {
     _canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.None);
     _canvasDrawerPointerState.HandleCanvasLeftMousePressed(new Point());
     Assert.IsTrue(true);
     _canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.Line);
     _canvasDrawerPointerState.HandleCanvasLeftMousePressed(new Point());
     Assert.IsTrue(_canvasDrawer.IsCalledSetCurrentState);
     Assert.IsInstanceOfType(_canvasDrawer.CurrentState, typeof(CanvasDrawerDrawingState));
 }
 public void TestHandleCanvasLeftMousePressed()
 {
     _canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.None);
     _canvasDrawerPointerState.HandleCanvasLeftMousePressed(new Point());
     Assert.IsTrue(_canvasDrawer.IsCalledGetSelectedResizingShapeDrawer);
     Assert.IsTrue(_canvasDrawer.IsCalledGetSelectedShapeShapeDrawer);
     Assert.IsTrue(_canvasDrawer.IsCalledNotifyCurrentShapeChanged);
     _canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.Line);
     _canvasDrawerPointerState.HandleCanvasLeftMousePressed(new Point());
     Assert.IsTrue(_canvasDrawer.IsCalledSetCurrentState);
     Assert.IsInstanceOfType(_canvasDrawer.CurrentState, typeof(CanvasDrawerDrawingState));
     Assert.IsTrue(_canvasDrawer.IsCalledNotifyCurrentShapeChanged);
 }
 public void Initialize()
 {
     _canvasDrawer = new CanvasDrawerMock(new CommandsManager());
     _canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.Line);
     _canvasDrawerDrawingState = new CanvasDrawerDrawingState(_canvasDrawer, new Point());
     _target = new PrivateObject(_canvasDrawerDrawingState);
 }
        public void TestCanvasDrawerDrawingState()
        {
            Assert.ThrowsException <ArgumentNullException>(() => new CanvasDrawerDrawingState(null, new Point()));
            Assert.ThrowsException <ArgumentNullException>(() => new CanvasDrawerDrawingState(new CanvasDrawerMock(new CommandsManager()), null));
            var canvasDrawer = new CanvasDrawerMock(new CommandsManager());

            canvasDrawer.SetCurrentShapeDrawerType(ShapeDrawerType.Rectangle);
            var currentDrawingShapeDrawingStartingPoint = new Point();
            var canvasDrawerDrawingState = new CanvasDrawerDrawingState(canvasDrawer, currentDrawingShapeDrawingStartingPoint);
            var target = new PrivateObject(canvasDrawerDrawingState);

            Assert.AreSame(target.GetFieldOrProperty(MEMBER_VARIABLE_NAME_CANVAS_DRAWER), canvasDrawer);
            Assert.AreSame(target.GetFieldOrProperty(MEMBER_VARIABLE_NAME_CURRENT_DRAWING_SHAPE_DRAWING_STARTING_POINT), currentDrawingShapeDrawingStartingPoint);
            Assert.IsInstanceOfType(target.GetFieldOrProperty(MEMBER_VARIABLE_NAME_CURRENT_DRAWING_SHAPE_HINT_SHAPE_DRAWER), typeof(RectangleDrawer));
        }