Exemplo n.º 1
0
        public void RubikOperationsParser_ParseCommand_ExpectedCount(string command, int count, int cleanedCount)
        {
            // 1. Prepare
            RubikOperationsParser p = new RubikOperationsParser();

            // 2. Execute
            var r = p.Parse(command);

            // 3. Verify
            Assert.Equal(count, r.Count());
        }
Exemplo n.º 2
0
        public void RubikOperationsParser_ParseSingleOperationCheckOrientation_BeExpected(string command)
        {
            // 1. Prepare
            RubikOperationsParser p = new RubikOperationsParser();

            // 2. Execute
            var r1 = p.Parse(command).Cast <RubikOperation>().FirstOrDefault();
            var r2 = p.Parse(command + "'").Cast <RubikOperation>().FirstOrDefault();

            // 3. Verify
            Assert.True(r1.IsClockwise);
            Assert.False(r2.IsClockwise);
        }
Exemplo n.º 3
0
        public void RubikOperationsParser_ParseInvalidCommand_ThrowOperationParsingException(string command, int badIndex)
        {
            // 1. Prepare
            RubikOperationsParser p = new RubikOperationsParser();

            // 2. Execute
            Action a = () => p.Parse(command);

            // 3. Verify
            var e = Assert.Throws <OperationParsingException>(a);

            Assert.Equal(command, e.Command);
            Assert.Equal(badIndex, e.Index);
        }