Exemplo n.º 1
0
        public void HarvestThrowsExceptionIfTileIsNotAdjacent()
        {
            var player = new Mock<IPlayer>();
            var vertex = new Mock<IVertex>();
            var tile = new Mock<ITile>();

            vertex.Setup(v => v.IsAdjacentTo(tile.Object)).Returns(false);
            var establisment = new Establishment(player.Object, vertex.Object);

            Assert.Throws<ArgumentException>(() => establisment.Harvest(tile.Object));
        }
Exemplo n.º 2
0
        public void HarvestValidatesThatEstbalismentAdjacentsTile()
        {
            var player = new Mock<IPlayer>();
            var vertex = new Mock<IVertex>();
            var tile = new Mock<ITile>();

            vertex.Setup(v => v.IsAdjacentTo(tile.Object)).Returns(true);
            var establisment = new Establishment(player.Object, vertex.Object);

            establisment.Harvest(tile.Object);

            vertex.Verify(v => v.IsAdjacentTo(tile.Object));
        }
Exemplo n.º 3
0
        public void HarvestAddsXResourcesToPlayer()
        {
            var player = new Mock<IPlayer>();
            var vertex = new Mock<IVertex>();
            var tileMock = new Mock<ITile>();
            tileMock.Setup(t => t.Rawmaterial).Returns(MaterialType.Grain);
            tileMock.Setup(t => t.Farm()).Returns(new Mock<IRawMaterial>().Object);

            var tile = tileMock.Object;
            vertex.Setup(v => v.IsAdjacentTo(tile)).Returns(true);

            var establisment = new Establishment(player.Object, vertex.Object);

            establisment.Harvest(tile);
            player.Verify(p => p.AddResources(It.IsAny<IRawMaterial>()), Times.Once());
        }
Exemplo n.º 4
0
        public void EstablismentShouldFarmTile()
        {
            var player = new Mock<IPlayer>();
            var vertex = new Mock<IVertex>();
            var tileMock = new Mock<ITile>();
            tileMock.Setup(t => t.Rawmaterial).Returns(MaterialType.Grain);

            var tile = tileMock.Object;
            vertex.Setup(v => v.IsAdjacentTo(tile)).Returns(true);

            var establisment = new Establishment(player.Object, vertex.Object);
            establisment.Harvest(tile);

            tileMock.Verify(t => t.Farm());
        }