public void WhenAPointIsOutOfRangeItCannotBeAdded() { var point = new ColouredPoint(Color.Red, new Point(30, 1)); var gameGrid = new GameGrid(10, 10); Assert.False(gameGrid.CanAdd(new[] { point })); }
public void WhenAddingAnOutOfRangePointReturnsFalse(int X, int Y) { var point = new ColouredPoint(Color.Red, new Point(X, Y)); var gameGrid = new GameGrid(10, 10); Assert.False(gameGrid.TryAdd(new[] { point })); }
public void WhenGridIsEmptyPointsCanBeAdded() { var point = new ColouredPoint(Color.Red, new Point(1, 1)); var gameGrid = new GameGrid(10, 10); Assert.True(gameGrid.CanAdd(new[] { point })); }
public void TwoPointsWithTheSameParametersAreObjectEqual(int X, int Y, string colourName) { var point1 = new ColouredPoint(Color.FromName(colourName), new Point(X, Y)); var point2 = new ColouredPoint(Color.FromName(colourName), new Point(X, Y)); Assert.True(point1.Equals((Object)point2)); }
public void TwoPointsWithTheSameParametersHaveSameHashCode(int X, int Y, string colourName) { var point1 = new ColouredPoint(Color.FromName(colourName), new Point(X, Y)); var point2 = new ColouredPoint(Color.FromName(colourName), new Point(X, Y)); Assert.AreEqual(point1.GetHashCode(), point2.GetHashCode()); }
public void TwoPointsWithDifferentParametersAreNotEqual(int X, int Y, string colourName) { var point1 = new ColouredPoint(Color.FromName(colourName), new Point(X, Y)); var point2 = new ColouredPoint(Color.Turquoise, new Point(X + 1, Y + 1)); Assert.False(point1.Equals(point2)); }
public void WhenConstructedPointIsSetCorrectly(int X, int Y) { var point = new Point(X, Y); var shape = new ColouredPoint(Color.Red, point); Assert.AreEqual(point, shape.Point); }
public void ColorIsSetCorrectly(string colorName) { var color = Color.FromName(colorName); var colouredPt = new ColouredPoint(color, new Point(1, 1)); Assert.AreEqual(color, colouredPt.Color); }
public void WhenAddingTheSamePointTwiceReturnsFalse() { var point = new ColouredPoint(Color.Red, new Point(1, 1)); var gameGrid = new GameGrid(10, 10); gameGrid.TryAdd(new[] { point }); Assert.False(gameGrid.TryAdd(new[] { point })); }
public void WhenADuplicatePointIsUsedItCannotBeAdded() { var point = new ColouredPoint(Color.Red, new Point(1, 1)); var gameGrid = new GameGrid(10, 10); gameGrid.TryAdd(new[] { point }); Assert.False(gameGrid.CanAdd(new[] { point })); }
public void WhenAPointIsAddedItIsEnumerated() { var gameGrid = new GameGrid(100, 120); var point = new ColouredPoint(Color.Red, new Point(1, 1)); gameGrid.TryAdd(new[] { point }); var enumerator = gameGrid.GetEnumerator(); Assert.True(enumerator.MoveNext()); Assert.AreEqual(point, enumerator.Current); Assert.False(enumerator.MoveNext()); }
public void IsNotEqualToNull() { var point1 = new ColouredPoint(Color.Turquoise, new Point(1, 1)); Assert.False(point1.Equals(null)); }
public void IsNotEqualToADifferentType() { var point1 = new ColouredPoint(Color.Turquoise, new Point(1, 1)); Assert.False(point1.Equals(new object())); }