public void AcceptTest() { var offer = new MaterialType[] { MaterialType.Brick, MaterialType.Brick }; var request = new MaterialType[] { MaterialType.Wool, MaterialType.Grain }; var offeredMaterials = offer.Select(m => new RawMaterial(m)).ToArray(); var requestedMaterrials = request.Select(m => new RawMaterial(m)).ToArray(); var player1 = new Mock<IPlayer>(); player1.Setup(p => p.HasResources(offer)).Returns(true); player1.Setup(p => p.TakeResources(offer)).Returns(offeredMaterials); var player2 = new Mock<IPlayer>(); player2.Setup(p => p.HasResources(request)).Returns(true); player2.Setup(p => p.TakeResources(request)).Returns(requestedMaterrials); var trade = new Trade(offer, request, player1.Object); trade.Accept(player2.Object); player1.Verify(p => p.TakeResources(offer), Times.Once); player2.Verify(p => p.TakeResources(request), Times.Once); player1.Verify(p => p.AddResources(requestedMaterrials), Times.Once); player2.Verify(p => p.AddResources(offeredMaterials), Times.Once); Assert.Equal(TradeState.Processed, trade.State); }