コード例 #1
0
    public void MinimalBoardWithNoTerritories()
    {
        var input = "B";
        var board = new GoCounting(input);

        var expected = new Dictionary <GoCounting.Player, IEnumerable <Point> >();

        Assert.That(board.Territories(), Is.EquivalentTo(expected));
    }
コード例 #2
0
    public void MinimalBoardWithNoTerritories()
    {
        var input = "B";
        var board = new GoCounting(input);

        var expected = new Dictionary <GoPlayer, IEnumerable <Tuple <int, int> > >();

        Assert.Equal(expected, board.Territories());
    }
コード例 #3
0
    public void OneTerritoryCoveringTheWholeBoard()
    {
        var input = " ";
        var board = new GoCounting(input);

        var expected = new Dictionary <GoCounting.Player, IEnumerable <Point> >
        {
            [GoCounting.Player.None] = new[] { new Point(0, 0) }
        };

        Assert.That(board.Territories(), Is.EquivalentTo(expected));
    }
コード例 #4
0
    public void TwoTerritoriesOnRectangularBoard()
    {
        var input = string.Join("\n", new[] { " BW ", " BW " });
        var board = new GoCounting(input);

        var expected = new Dictionary <GoCounting.Player, IEnumerable <Point> >
        {
            [GoCounting.Player.Black] = new[] { new Point(0, 0), new Point(0, 1) },
            [GoCounting.Player.White] = new[] { new Point(3, 0), new Point(3, 1) }
        };

        Assert.That(board.Territories(), Is.EquivalentTo(expected));
    }
コード例 #5
0
    public void OneTerritoryCoveringTheWholeBoard()
    {
        var input  = " ";
        var board  = new GoCounting(input);
        var actual = board.Territories();

        var expected = new Dictionary <GoPlayer, IEnumerable <Tuple <int, int> > >
        {
            [GoPlayer.None] = new[] { new Tuple <int, int>(0, 0) }
        };

        Assert.Equal(expected.Keys, actual.Keys);
        Assert.Equal(expected[GoPlayer.None], actual[GoPlayer.None]);
    }
コード例 #6
0
    public void TwoTerritoriesOnRectangularBoard()
    {
        var input  = string.Join("\n", new[] { " BW ", " BW " });
        var board  = new GoCounting(input);
        var actual = board.Territories();

        var expected = new Dictionary <GoPlayer, IEnumerable <Tuple <int, int> > >
        {
            [GoPlayer.Black] = new[] { new Tuple <int, int>(0, 0), new Tuple <int, int>(0, 1) },
            [GoPlayer.White] = new[] { new Tuple <int, int>(3, 0), new Tuple <int, int>(3, 1) }
        };

        Assert.Equal(expected.Keys, actual.Keys);
        Assert.Equal(expected[GoPlayer.Black], actual[GoPlayer.Black]);
        Assert.Equal(expected[GoPlayer.White], actual[GoPlayer.White]);
    }