Exemple #1
0
        public void SquareCanBeGeneratedUsingStringConstructor()
        {
            MagicSquare square = new MagicSquare("4,9,2,3,5,7,8,1,5");

            var squareState = square.GetSquareState();

            squareState.Should().HaveCount(9);
            squareState[0, 0].Should().Be(4);
            squareState[1, 0].Should().Be(3);
            squareState[2, 0].Should().Be(8);
            squareState[2, 2].Should().Be(5);
        }
Exemple #2
0
        public void SquareCanBeGeneratedUsingArrayConstructor()
        {
            MagicSquare square = new MagicSquare(
                new[, ]
            {
                { 4, 9, 2 },
                { 3, 5, 7 },
                { 8, 1, 5 },
            });

            var squareState = square.GetSquareState();

            squareState.Should().HaveCount(9);
            squareState[0, 0].Should().Be(4);
            squareState[1, 0].Should().Be(3);
            squareState[2, 0].Should().Be(8);
            squareState[2, 2].Should().Be(5);
        }