Ejemplo n.º 1
0
        public void PassingNoCorrectColorsReturnsEmptyResults()
        {
            var expected          = new PinResult[] { };
            var computerPinColors = new[] { PinColor.Blue, PinColor.Blue, PinColor.Blue, PinColor.Blue };
            var userPinColors     = new[] { PinColor.Red, PinColor.Red, PinColor.Red, PinColor.Red };
            var sut    = new Mastermind(computerPinColors);
            var result = sut.Check(userPinColors);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 2
0
        public void PassingAllCorrectColorsInCorrectOrderReturnsAllBlack()
        {
            var expected          = new[] { PinResult.Black, PinResult.Black, PinResult.Black, PinResult.Black };
            var computerPinColors = new[] { PinColor.Blue, PinColor.Green, PinColor.Red, PinColor.White };
            var userPinColors     = new[] { PinColor.Blue, PinColor.Green, PinColor.Red, PinColor.White };
            var sut    = new Mastermind(computerPinColors);
            var result = sut.Check(userPinColors);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 3
0
        public void PassingOneCorrectColorsInCorrectPositionReturnsOneBlackPeg()
        {
            var expected          = new[] { PinResult.Black };
            var computerPinColors = new[] { PinColor.Blue, PinColor.Blue, PinColor.Blue, PinColor.Blue };
            var userPinColors     = new[] { PinColor.Blue, PinColor.Red, PinColor.Red, PinColor.Red };
            var sut    = new Mastermind(computerPinColors);
            var result = sut.Check(userPinColors);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 4
0
        private static void Assert(Mastermind sut, IReadOnlyCollection <string> readOnlyCollection, IEnumerable <PinResult> pinResults)
        {
            var result1 = sut.Check(readOnlyCollection);

            Xunit.Assert.Equal(pinResults, result1);
        }