public void GetRandomBallPositionFromNullWindow() { // arrange Window window = null; // act var randomBallPosition = GameHelpers.GetRandomBallPosition(window); // assert Assert.IsNull(randomBallPosition); }
public void GetRandomBallPositionFromWindow() { // arrange var window = new Window(); for (var holeCount = 0; holeCount < 5; holeCount++) { var hole = new Hole { X = 0, Y = holeCount }; window.Holes.Add(hole); } // act var randomBallPosition = GameHelpers.GetRandomBallPosition(window); // assert Assert.IsNotNull(randomBallPosition); Assert.IsFalse(window.Holes.Any(hole => hole.X == Convert.ToInt32(randomBallPosition.Value.X) && hole.Y == Convert.ToInt32(randomBallPosition.Value.Y))); }
public void GetRandomBallPositionFromWindowWithMaximumHoles() { // arrange var window = new Window(); for (var rowCount = 0; rowCount < GameConfiguration.GameGridSize; rowCount++) { for (var columnCount = 0; columnCount < GameConfiguration.GameGridSize; columnCount++) { var hole = new Hole { X = rowCount, Y = columnCount }; window.Holes.Add(hole); } } // act var randomBallPosition = GameHelpers.GetRandomBallPosition(window); // assert Assert.IsNull(randomBallPosition); }