I am learning about unit testing using the NUnit framework.

I built a monopoly game in a console application and am now conducting unit tests for each class.

I am struggling with writing a test for my game class that only takes 1 method:

public abstract class Game: GameInterface
        private int playersCount;

        public abstract void initializeGame();
        public abstract void makePlay(int player);
        public abstract bool endOfGame();
        public abstract void printWinner();

        // A template method : 
        public void playOneGame(int playersCount)
            this.playersCount = playersCount;
            int j = 0;
            while (!endOfGame())
                j = (j + 1) % playersCount;

How could I write a test for this using the NUnit framework??


Since Game is an abstract class, you need to create a concrete class derived from it without the playOneGame method, and then instantiate it, and run that method, testing the output from a number of inputs. You will have to implement the abstract methods declared in the Game class.