public void RubikCube_Rotate_CenterStayInPlace(string axisId) { // 1. Prepare RubikCube c = new RubikCube(3); var axis = c.GetAxis(axisId); var center = c.Blocks.Where(b => b.Position.IsSameVector(axis.Vector)).First(); var initialPosition = center.Position; // 2. Execute c.RotateAround(axis, true); // 3. Verify Assert.Equal(initialPosition.X, center.Position.X, PRECISION_DOUBLE); Assert.Equal(initialPosition.Y, center.Position.Y, PRECISION_DOUBLE); Assert.Equal(initialPosition.Z, center.Position.Z, PRECISION_DOUBLE); }
public void RubikCube_RotateOnceOnSize2_FindExpectedFace(string axisId, bool isClockwise, string blockCoordinate, string checkedFaceId, string expectedBlockFace) { // 1. Prepare Cartesian3dCoordinate blockPosition = new Cartesian3dCoordinate(blockCoordinate); RubikCube c = new RubikCube(2); var axis = c.GetAxis(axisId); var initialBlock = c.Blocks.FirstOrDefault(b => b.Position.IsSameVector(blockPosition)); var targetFaceVector = c.GetFace(checkedFaceId).Coordinates.Normal; // 2. Execute c.RotateAround(axis, isClockwise); var block = c.Blocks.FirstOrDefault(b => b.Position.IsSameVector(blockPosition)); var face = block.GetBlockFace(targetFaceVector); // 3. Verify Assert.NotEqual(initialBlock.Id, block.Id); Assert.NotNull(face); Assert.Equal(expectedBlockFace, face.Id); }