public void GameGoToNextShouldMoveCurrentSetToNextSet() { var game = new PingPongGame(); game.GenerateSets(7); game.Start(); var expected = 1; var actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 2; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 3; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 4; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); }
public void GameGoToNextShouldMoveCurrentSetToNextSet() { var game = new PingPongGame(); game.GenerateSets(7); game.Start(); var expected = 1; var actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 2; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 3; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToNextSet(); expected = 4; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); }
public void GameGenerateSetsShouldBeCalledBeforeGameStart() { var game = new PingPongGame(); game.Start(); game.GenerateSets(11); }
public void GameGoToSetShouldMoveCurrentSetToGivenArgument() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.GoToSet(1); var expected = 1; var actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(2); expected = 2; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(4); expected = 4; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(8); expected = 8; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(1); expected = 1; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); }
public MainWindowViewModel() { _game = new PingPongGame(); _game.GenerateSets(11); _game.Start(); }
public void GameGenerateSetsShouldThrowIfArgumentIsNegativeOrZero() { var game = new PingPongGame(); game.GenerateSets(-1); game.GenerateSets(0); }
public void GameGenerateSetsShouldThrowIfArgumentIsNegativeOrZero() { var game = new PingPongGame(); game.GenerateSets(-1); game.GenerateSets(0); }
public void GameGenerateSetsShouldBeCalledBeforeGameStart() { var game = new PingPongGame(); game.Start(); game.GenerateSets(11); }
// Use this for initialization void Start() { // if (isOpposite) { if (GvrSettings.Handedness.Equals(GvrSettings.UserPrefsHandedness.Left)) { playingHand = PlayingHand.leftHand; } else { playingHand = PlayingHand.rightHand; } } pingPongGame = GameObject.Find("PingPongGame").GetComponent <PingPongGame>(); if (!isOpposite) { InitializeOpponent(); } randomness = Random.value; originalPosition = this.transform.position; targetPosition = originalPosition; IntermediateTargetPoisition = targetPosition; //GetComponent<Renderer>().material.color.a = 0; if (isOpposite) { setAvatarTransparent(); } }
// Use this for initialization void Start() { pingPongGame = GameObject.Find("PingPongGame").GetComponent <PingPongGame>(); Opponent opp = pingPongGame.opponentContainer.GetOpponent(opponentTag); ColorBlock cb = this.GetComponent <Button>().colors; cb.normalColor = new Color(opp.colorRed / 255f, opp.colorGreen / 255f, opp.colorBlue / 255f); this.GetComponent <Button>().colors = cb; cb.highlightedColor = new Color(opp.colorRed / 255f * brightFactor, opp.colorGreen / 255f * brightFactor, opp.colorBlue / 255f * brightFactor); this.GetComponent <Button>().colors = cb; cb.pressedColor = new Color(opp.colorRed / 255f * darkFactor, opp.colorGreen / 255f * darkFactor, opp.colorBlue / 255f * darkFactor); this.GetComponent <Button>().colors = cb; // change name text to xml defined name gameObject.GetComponentInChildren <Text>().text = opp.name; }
public ActionResult PingPongResult() { int userNumber = int.Parse(Request.Form["number"]); PingPongGame newGame = new PingPongGame(userNumber); return(View(newGame)); }
public void ReturnPingWhenInputtingThree() { PingPongGame game = new PingPongGame(); string expectedResult = "ping"; int testValue = 3; Assert.AreEqual(expectedResult, game.ReturnMessage(testValue)); }
public void NumberList_CompareList_True() { PingPongGame testPingPongGame = new PingPongGame(); CollectionAssert.AreEqual(new List <int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, testPingPongGame.NumberList(15)); }
public void GameGoToPreviousShouldThrowIfArgumentIsLesserThanZero() { var game = new PingPongGame(); game.GenerateSets(1); game.Start(); game.GoToPreviousSet(); }
public void GameStateShouldDefaultToNotSet() { var game = new PingPongGame(); var expectedState = PingPongGameState.NotSet; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public void GameGoToNextSetShouldThrowIfArgumentIsGreaterThanIndexOfLastSet() { var game = new PingPongGame(); game.GenerateSets(1); game.Start(); game.GoToNextSet(); }
public void GameGoToNextSetShouldThrowIfArgumentIsGreaterThanIndexOfLastSet() { var game = new PingPongGame(); game.GenerateSets(1); game.Start(); game.GoToNextSet(); }
public void GameGoToSetShouldThrowIfArgumentIsOutsideOfNumberOfSetsBounds() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.GoToSet(-1); game.GoToSet(12); }
public void PingPong_Replace3ByPing_ListOfNumbers() { PingPongGame testPingPong = new PingPongGame(4); List <object> expected = new List <object>() { 1, 2, "ping", 4 }; List <object> actual = testPingPong.PingPong(); CollectionAssert.AreEqual(expected, actual); }
public void GameStartSetsStateToStarted() { var game = new PingPongGame(); game.Start(); var expectedState = PingPongGameState.Started; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public void GameEndSetsStateToFinished() { var game = new PingPongGame(); game.End(); var expectedState = PingPongGameState.Finished; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public void GameEndSetsStateToFinished() { var game = new PingPongGame(); game.End(); var expectedState = PingPongGameState.Finished; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public void GameMarkSetAsFaultForTeamShouldThrowIfArgumentIsNegativeZeroOrGreaterThanTwo() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.MarkSetAsFaultForTeam(-1); game.MarkSetAsFaultForTeam(0); game.MarkSetAsFaultForTeam(3); }
void Awake() { GameObject go1 = GameObject.Find("PingPongGame"); pingPongGame = (PingPongGame)go1.GetComponent(typeof(PingPongGame)); bool beaten = pingPongGame.opponentContainer.GetOpponent(referenceTag).beaten; if (beaten) { this.GetComponent <Image>().color = new Color(0.0f, 0.0f, 1.0f); } }
public void PingPong_CountTo2_ListOfNumbers() { //Arrange PingPongGame testPingPong = new PingPongGame(2); List <object> expected = new List <object>() { 1, 2 }; //Act List <object> actual = testPingPong.PingPong(); //Assert CollectionAssert.AreEqual(expected, actual); }
public void PingPong_Replace15ByPingPong_ListOfObject() { //Arrange PingPongGame testPingPong = new PingPongGame(15); List <object> expected = new List <object>() { 1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "pingpong" }; //Act List <object> actual = testPingPong.PingPong(); //Assert CollectionAssert.AreEqual(expected, actual); }
public void GameMarkSetAsPointForTeamShouldMarkCurrentSetAsAPointForAGivenTeam() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.MarkSetAsPointForTeam(1); var expected = 1; var actual = game.CurrentSet.ForTeam; Assert.AreEqual(expected, actual); }
protected override void OnProcess(List <Entity> _entities, int width, int height) { var rightKeyPressed = _input?.PressedKey == ConsoleKey.RightArrow; var leftKeyPressed = _input?.PressedKey == ConsoleKey.LeftArrow; var enterPressed = _input?.PressedKey == ConsoleKey.Enter; var menuElements = _entities.OfType <SelectableText>(); var enumerable = menuElements as SelectableText[] ?? menuElements.ToArray(); if (enterPressed) { var selectedElement = enumerable.FirstOrDefault(x => x.GetSelected()); switch (selectedElement) { case StartButton _: PingPongGame.Instance.GameService <SceneService>().LoadNextLevel(); break; case ExitButton _: PingPongGame.Stop(); break; } } if (!leftKeyPressed && !rightKeyPressed) { return; } foreach (var entity in enumerable) { entity.SetSelected(false); switch (entity) { case StartButton startButton: startButton.SetSelected(_input.PressedKey == ConsoleKey.LeftArrow); break; case ExitButton exitButton: exitButton.SetSelected(_input.PressedKey == ConsoleKey.RightArrow); break; } } }
public BasePingPongGameStepDefinition() { _game = new PingPongGame(); }
public void GameGoToSetShouldMoveCurrentSetToGivenArgument() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.GoToSet(1); var expected = 1; var actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(2); expected = 2; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(4); expected = 4; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(8); expected = 8; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); game.GoToSet(1); expected = 1; actual = game.CurrentSet.Number; Assert.AreEqual(expected, actual); }
public void GameGoToPreviousShouldThrowIfArgumentIsLesserThanZero() { var game = new PingPongGame(); game.GenerateSets(1); game.Start(); game.GoToPreviousSet(); }
public void GameMarkSetAsPointForTeamShouldMarkCurrentSetAsAPointForAGivenTeam() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.MarkSetAsPointForTeam(1); var expected = 1; var actual = game.CurrentSet.ForTeam; Assert.AreEqual(expected, actual); }
public void GameGoToSetShouldThrowIfArgumentIsOutsideOfNumberOfSetsBounds() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.GoToSet(-1); game.GoToSet(12); }
public void PingPongFiveThree_NumberDisvibleByFiveThree_True() { PingPongGame testPingPongGame = new PingPongGame(); Assert.AreEqual(true, testPingPongGame.PingPongFiveThree(15)); }
public void GameMarkSetAsPointForTeamShouldThrowIfArgumentIsNegativeZeroOrGreaterThanTwo() { var game = new PingPongGame(); game.GenerateSets(11); game.Start(); game.MarkSetAsPointForTeam(-1); game.MarkSetAsPointForTeam(0); game.MarkSetAsPointForTeam(3); }
public void GameStartSetsStateToStarted() { var game = new PingPongGame(); game.Start(); var expectedState = PingPongGameState.Started; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public void GameStateShouldDefaultToNotSet() { var game = new PingPongGame(); var expectedState = PingPongGameState.NotSet; var actualState = game.State; Assert.AreEqual(expectedState, actualState); }
public static void Main() { PingPongGame game = new PingPongGame(); game.Run(); }