public void WinnerHasTheHighestScore() { //arrange var consoleOperations = new Mock <IConsoleOperations>(); var playerHuman = new PlayerHuman(consoleOperations.Object, "1"); var playerHuman2 = new PlayerHuman(consoleOperations.Object, "2"); var playerComputer = new PlayerComputer(consoleOperations.Object); var playerHumanList = new List <IPlayer>() { playerHuman, playerHuman2 }; var mockRandomChooser = new Mock <IRandomChooser>(); mockRandomChooser.SetupSequence(s => s.RandomNumber(It.IsAny <int>(), It.IsAny <int>())) .Returns(10).Returns(12).Returns(13); consoleOperations.SetupSequence(s => s.Read()).Returns("1").Returns("0").Returns("0"); var game = new Game(consoleOperations.Object, playerHumanList, mockRandomChooser.Object); //act game.Start(); //assert //Assert.Contains(); how to test that? consoleOperations.Verify( m => m.Write(It.Is <string>(c => c == "Dealer wins !"))); }
public TicTacToeEngine(Grid2DComponent grid, Player p1, Player p2) { this.grid = grid; CreateGameBoard( ); p1_X = p1 as PlayerComputer; p2_O = p2 as PlayerHuman; p1_X.IsTurnActive = false; p2_O.IsTurnActive = true; audioplayer = MonoBehaviour.FindObjectOfType <SFXMasterController> ( ).GetComponent <AudioSource> ( ); zeroedVol = audioplayer.volume; sfxvictorymusic = Resources.Load <AudioClip> (ResourcePath.onWinSoundClip); sfxgameover = Resources.Load <AudioClip> (ResourcePath.sfxGameOver); sfxwinner = Resources.Load <AudioClip> (ResourcePath.sfxWinner); sfxscribblebank = SFXMasterController.LoadScribbleSFX( ); SFXMasterController.PlayReadyClip( ); }