public void ShouldSideFieldThrowsSquare(Side location) { var fieldSetting = new FieldSetting() { HorzDimension = 5, VertDimension = 4, SideDimension = 3 }; var sideField = SideField.Create(fieldSetting, location); bool same = true; for (uint i = 0; i < sideField.Width; i++) { var color = sideField[i, 0].Color; var secondColor = sideField[i, 1].Color; var thirdColor = sideField[i, 2].Color; var throwColor = sideField.Pop(i); color.ShouldBe(throwColor); sideField[i, 0].Color.ShouldBe(secondColor); sideField[i, 1].Color.ShouldBe(thirdColor); sideField[i, 2].Color.ShouldNotBe(Color.None); same &= sideField[i, 2].Color == thirdColor; } same.ShouldBeFalse(); }
public void ShouldCreateSideField(Side location, Direction direction) { var fieldSetting = new FieldSetting() { HorzDimension = 5, VertDimension = 4, SideDimension = 3 }; var sideField = SideField.Create(fieldSetting, location); var width = (location == Side.Left || location == Side.Right) ? fieldSetting.VertDimension : fieldSetting.HorzDimension; sideField.Width.ShouldBe(width); sideField.Height.ShouldBe(fieldSetting.SideDimension); sideField.ThrowDirection.Value.ShouldBe(direction); }
public void SholdGenerateValuesForSideFields() { var fieldSetting = new FieldSetting() { HorzDimension = 5, VertDimension = 4, SideDimension = 3 }; var sideField = SideField.Create(fieldSetting, Side.Bottom); sideField.Generate(); sideField.ForEach((item) => { item.Color.ShouldNotBe(Color.None); }); }
public void ShouldReturnReadonlyMatrix() { var fieldSetting = new FieldSetting() { HorzDimension = 5, VertDimension = 4, SideDimension = 3 }; var sideField = SideField.Create(fieldSetting, Side.Bottom); var matrix = sideField.ToReadonlyMatrix(); matrix.ShouldNotBeNull(); sideField.ForEach((item, x, y) => matrix[x, y].ShouldBe(item)); }
public Scene(FieldSetting setting) { _matrixField = MainField.Create(setting); _sideFields = new Dictionary <Side, SideField> { [Side.Top] = SideField.Create(setting, Side.Top), [Side.Left] = SideField.Create(setting, Side.Left), [Side.Bottom] = SideField.Create(setting, Side.Bottom), [Side.Right] = SideField.Create(setting, Side.Right) }; _movingSquare = new MovingSquare(); _movingSquare.StateChanged += HandleMovingSquareStateChangedEvent; _score = new Score(setting); _score.ScoreUpdated += HandleScoreUpdatedEvent; _stateManagers = new List <IStateManager>(); InitStateManagersList(); }
public void ShouldSideFieldPutsSquare(Side location) { var fieldSetting = new FieldSetting() { HorzDimension = 5, VertDimension = 4, SideDimension = 3 }; var sideField = SideField.Create(fieldSetting, location); for (uint i = 0; i < sideField.Width; i++) { var color = sideField[i, 0].Color; var secondColor = sideField[i, 1].Color; sideField.Push(i, Color.Red); sideField[i, 0].Color.ShouldBe(Color.Red); sideField[i, 1].Color.ShouldBe(color); sideField[i, 2].Color.ShouldBe(secondColor); } }