public FileProcessor(IFileReader fileReader, IFileWriter fileWriter, ICanvasGenerator canvasService, IShapeGenerator <Line> lineService, IShapeGenerator <Rectangle> rectangleService, IBucketFillGenerator bucketFillService) { _fileReader = fileReader; _fileWriter = fileWriter; _canvasService = canvasService; _lineService = lineService; _rectangleService = rectangleService; _bucketFillService = bucketFillService; }
public Game(int width, int height, IShapeGenerator generator, GameLevel[] levels, ITetrisUI ui, ISynchronizeInvoke syncObj) { _isInProgress = false; _gameField = new GameField(width, height); _generator = generator; _UI = ui; _UI.UserAction += OnUserAction; _shapeStartPosition = new Point(width / 2, 2); _current = new Shape(_generator.ShapeSet.MaxPointsInShape); _next = new Shape(_generator.ShapeSet.MaxPointsInShape); _modified = new Shape(_generator.ShapeSet.MaxPointsInShape); _levels = (GameLevel[])levels.Clone(); _fallTimer = new Timer(); _fallTimer.Interval = _levels[_levelIndex].FallDelay.TotalMilliseconds; _fallTimer.Elapsed += OnTimeToFall; if (syncObj != null) { _fallTimer.SynchronizingObject = syncObj; } }
public void RectangleService_CreateShape_NoMock_Test() { // Given Canvas canvas = new Canvas(4, 4); Rectangle rectangle = new Rectangle(new Point(1, 1), new Point(2, 2)); _rectangleService = new RectangleService(new LineService()); // When _rectangleService.CreateShape(ref canvas, rectangle); // Then Assert.AreEqual('\0', canvas.Matrix[0, 0]); Assert.AreEqual('\0', canvas.Matrix[0, 1]); Assert.AreEqual('\0', canvas.Matrix[0, 2]); Assert.AreEqual('\0', canvas.Matrix[1, 0]); Assert.AreEqual('\0', canvas.Matrix[2, 0]); Assert.AreEqual('x', canvas.Matrix[1, 1]); Assert.AreEqual('x', canvas.Matrix[1, 2]); Assert.AreEqual('x', canvas.Matrix[2, 1]); Assert.AreEqual('x', canvas.Matrix[2, 2]); }
public CircularCloudPrepossessing(Point center, IShapeGenerator generator) { Center = center; rectangles = new List <Rectangle>(); shape = generator; }
public ShapeGeneratorController(IShapeGenerator shapeGenerator) { this.shapeGenerator = shapeGenerator; }
public void LineService_TestInitialize() { _lineService = new LineService(); }
public RectangleService(IShapeGenerator <Line> lineGenerator) { _lineGenerator = lineGenerator; }
public void RectangleService_TestInitialize() { _lineGenerator = new Mock <IShapeGenerator <Line> >(); _rectangleService = new RectangleService(_lineGenerator.Object); }