Example #1
0
        public void CanRotateReletiveCubeFaces()
        {
            var cube = new ThreeByThreeCube();

            cube.RotateClockwise(cube.FrontFace);
            cube.RotateCounterClockwise(cube.FrontFace);

            Assert.True(cube.IsSolved);

            cube.RotateClockwise(cube.BackFace);
            cube.RotateCounterClockwise(cube.BackFace);

            Assert.True(cube.IsSolved);

            cube.RotateClockwise(cube.LeftFace);
            cube.RotateCounterClockwise(cube.LeftFace);

            Assert.True(cube.IsSolved);

            cube.RotateClockwise(cube.RightFace);
            cube.RotateCounterClockwise(cube.RightFace);

            Assert.True(cube.IsSolved);

            cube.RotateClockwise(cube.TopFace);
            cube.RotateCounterClockwise(cube.TopFace);

            Assert.True(cube.IsSolved);

            cube.RotateClockwise(cube.BottomFace);
            cube.RotateCounterClockwise(cube.BottomFace);

            Assert.True(cube.IsSolved);
        }
Example #2
0
        public void RoateCounterClockwiseThrowsAninvalidOperationExceptionWhenTheFaceDoesNotBelongToTheCube()
        {
            var cube = new ThreeByThreeCube();

            Assert.Throws <InvalidOperationException>(() => cube.RotateCounterClockwise(new ThreeByThreeCubeFace(Color.White)));
        }
Example #3
0
        public void RoateCounterClockwiseThrowsAnArgumentNullExceptionWhenGivenNull()
        {
            var cube = new ThreeByThreeCube();

            Assert.Throws <ArgumentNullException>(() => cube.RotateCounterClockwise(null));
        }