public void GetInternalPosition_WithASolutionInLowerCase_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string TestPosition = @" yyy yyy yyy bbb rrr ggg ooo bbb rrr ggg ooo bbb rrr ggg ooo hhh hhh hhh "; CubeColor[, ,] expected = BuildInternalArrayForSolution(); //Act CubeColor[, ,] actual = cube.ToInternalPositionArray(TestPosition); //Assert AssertAreEqualPositons(expected, actual); }
public void IsValidPosition_WithToShortLine8_ShouldThrowAnException() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string TestPosition = @" yyy yyy yyy bbb rrr ggg ooo bbb rrr ggg ooo bbb rrr ggg ooo hhh h h hhh "; //Act cube.IsValidPosition(TestPosition); //Assert is implicit }
public void GetInternalPosition_WithLeftLayerRotatedUp_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string TestPosition = @" ryy ryy ryy bbb hrr ggg ooy bbb hrr ggg ooy bbb hrr ggg ooy ohh ohh ohh "; CubeColor[, ,] expected = BuildInternalArrayForSolution(); expected[0, 0, 0] = CubeColor.R; expected[0, 1, 0] = CubeColor.R; expected[0, 2, 0] = CubeColor.R; expected[2, 0, 0] = CubeColor.H; expected[2, 1, 0] = CubeColor.H; expected[2, 2, 0] = CubeColor.H; expected[4, 0, 2] = CubeColor.Y; expected[4, 1, 2] = CubeColor.Y; expected[4, 2, 2] = CubeColor.Y; expected[5, 0, 0] = CubeColor.O; expected[5, 1, 0] = CubeColor.O; expected[5, 2, 0] = CubeColor.O; //Act CubeColor[, ,] actual = cube.ToInternalPositionArray(TestPosition); //Assert Assert.IsNotNull(actual); AssertAreEqualPositons(expected, actual); }
public void IsValidPosition_WithASolutionInLowerCase_ShouldBeTrue() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string TestPosition = @" yyy yyy yyy bbb rrr ggg ooo bbb rrr ggg ooo bbb rrr ggg ooo hhh hhh hhh "; //Act bool actual = cube.IsValidPosition(TestPosition); //Assert Assert.IsTrue(actual, "The solution is a valid position"); }
public void IsValidPosition_WithASolutionInUpperCase_ShouldBeTrue() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string TestPosition = @" YYY YYY YYY BBB RRR GGG OOO BBB RRR GGG OOO BBB RRR GGG OOO HHH HHH HHH "; //Act bool actual = cube.IsValidPosition(TestPosition); //Assert Assert.IsTrue(actual, "The solution is a valid position"); }
public void GetPoint_WithLine9Column2_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(9, 2); //Assert Assert.AreEqual(Side.Bottom, actual.Side); Assert.AreEqual(Row.Bottom, actual.Row); Assert.AreEqual(Column.Middle, actual.Column); }
public void GetPoint_WithLine9Column4_ShouldThrowAnException() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act cube.GetPoint(9, 4); //Assert is implicit }
public void GetPoint_WithLine6Column4_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(6, 4); //Assert Assert.AreEqual(Side.Front, actual.Side); Assert.AreEqual(Row.Bottom, actual.Row); Assert.AreEqual(Column.Left, actual.Column); }
public void GetPoint_WithLine7Column3_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(7, 3); //Assert Assert.AreEqual(Side.Bottom, actual.Side); Assert.AreEqual(Row.Top, actual.Row); Assert.AreEqual(Column.Right, actual.Column); }
public void GetPoint_WithLine4Column5_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(4, 5); //Assert Assert.AreEqual(Side.Front, actual.Side); Assert.AreEqual(Row.Top, actual.Row); Assert.AreEqual(Column.Middle, actual.Column); }
public void GetPoint_WithLine5Column8_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(5, 8); //Assert Assert.AreEqual(Side.Right, actual.Side); Assert.AreEqual(Row.Middle, actual.Row); Assert.AreEqual(Column.Middle, actual.Column); }
public void GetPoint_WithLine4Column10_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); //Act Point actual = cube.GetPoint(4, 10); //Assert Assert.AreEqual(Side.Back, actual.Side); Assert.AreEqual(Row.Top, actual.Row); Assert.AreEqual(Column.Left, actual.Column); }
public void ValidateInternalPositionArray_WithToManyRAndToFewY_ShouldThrowException() { //Arrange var cube = new Cube.Model.Impl.Cube(); CubeColor[, ,] testInternalArray = BuildInternalArrayForSolution(); //One additional R and one missing Y testInternalArray[0, 0, 0] = CubeColor.R; //Act cube.ValidateInternalPositionArray(testInternalArray); //Assert is implisit }
public void ValidateInternalPositionArray_WithSwapedMiddleRAndG_ShouldThrowException() { //Arrange var cube = new Cube.Model.Impl.Cube(); CubeColor[, ,] testInternalArray = BuildInternalArrayForSolution(); //Swap middle R and G testInternalArray[2, 1, 1] = CubeColor.G; testInternalArray[3, 1, 1] = CubeColor.R; //Act cube.ValidateInternalPositionArray(testInternalArray); //Assert is implisit }
public void ValidateInternalPositionArray_WithSolution_ShouldNotThrowExcetion() { //Arrange var cube = new Cube.Model.Impl.Cube(); CubeColor[, ,] testInternalArray = BuildInternalArrayForSolution(); //Act cube.ValidateInternalPositionArray(testInternalArray); //Assert is implisit }
public void ToPosition_WithSolution_ShouldWork() { //Arrange var cube = new Cube.Model.Impl.Cube(); const string Expected = @" yyy yyy yyy bbb rrr ggg ooo bbb rrr ggg ooo bbb rrr ggg ooo hhh hhh hhh "; CubeColor[, ,] testInternalArray = BuildInternalArrayForSolution(); //Act string actual = cube.ToPosition(testInternalArray); //Assert Assert.AreEqual(Expected, actual); }