Example #1
0
        public void ProcessGameSequences_ShouldReturnExactNumberOfSequences()
        {
            //Arrange
            var sequence  = "L L M L M M M L M M M";
            var sequences = new List <MoveBehaviorEnum>();

            foreach (var step in sequence.Split(' '))
            {
                sequences.Add(step.ToMoveBehaviorEnum());
            }
            _gameSetting.Sequences = new List <List <MoveBehaviorEnum> > {
                sequences, sequences
            };

            var sequenceMoveHandler = new SequenceMoveHandler(_gameSetting);
            var sequenceProcessor   =
                new Application.SequenceProcessor.SequenceProcessor(_gameSetting, sequenceMoveHandler);
            //Act
            var result = sequenceProcessor.ProcessGameSequences().ToList();

            //Assert
            Assert.Equal(2, result.Count);
            Assert.Equal(ResultEnum.MineHit, result[0].Result);
            Assert.Equal(ResultEnum.MineHit, result[1].Result);
        }
Example #2
0
        public void ProcessGameSequences_ShouldReturnCorrectResult(string sequence, ResultEnum expectedResult)
        {
            //Arrange
            var sequences = new List <MoveBehaviorEnum>();

            foreach (var step in sequence.Split(' '))
            {
                sequences.Add(step.ToMoveBehaviorEnum());
            }

            _gameSetting.Sequences = new List <List <MoveBehaviorEnum> > {
                sequences
            };

            var sequenceMoveHandler = new SequenceMoveHandler(_gameSetting);
            var sequenceProcessor   =
                new Application.SequenceProcessor.SequenceProcessor(_gameSetting, sequenceMoveHandler);
            //Act
            var result = sequenceProcessor.ProcessGameSequences().ToList();

            //Assert
            Assert.Equal(expectedResult, result[0].Result);
        }