public void ClearPlayerHistoryEmptiesPlayerRolls() { //Arrange GameVariables.Round = 1; testMain.crapsDataSet.Clear(); testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet); PlayerController.AddAndActivatePlayer("RollTest", testMain); GameController.NewGame(testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); //Act PlayerController.ClearPlayerHistory(testMain); //Assert int afterClearRolls = testMain.crapsDataSet.Roll.Rows.Count; Assert.AreEqual(0, afterClearRolls); }
public void ClearPlayerHistoryEmptiesPlayerGames() { //Arrange GameVariables.Round = 1; testMain.crapsDataSet.Clear(); testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet); PlayerController.AddAndActivatePlayer("RollTest", testMain); GameController.NewGame(testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); //Act PlayerController.ClearPlayerHistory(testMain); //Assert int afterClearGames = testMain.crapsDataSet.Game.Rows.Count; Assert.AreEqual(1, afterClearGames); //this should equal 1 because Clearing History starts a new game automatically }
public void PopulateRollsAddsRollRowtoDBTest() { //Arrange GameVariables.Round = 1; testMain.crapsDataSet.Clear(); testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet); PlayerController.AddAndActivatePlayer("RollTest", testMain); GameController.NewGame(testMain); int beforePopRolls = (testMain.crapsDataSet.Roll.Rows.Count); //Act DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); //Assert int afterPopRolls = (testMain.crapsDataSet.Roll.Rows.Count); Assert.AreEqual(beforePopRolls + 1, afterPopRolls); }
public void DeletePlayerEmptiesRemovesPlayerfromDB() { //Arrange GameVariables.Round = 1; testMain.crapsDataSet.Clear(); testMain.tableAdapterManager.UpdateAll(testMain.crapsDataSet); PlayerController.AddAndActivatePlayer("DeleteTest", testMain); GameController.NewGame(testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); DiceController.PopulateRolls(new int[2] { 1, 1 }, testMain); //Act PlayerController.DeletePlayer(testMain); //Assert Assert.AreEqual(0, testMain.crapsDataSet.User.Select("Name = '" + "DeleteTest" + "'").Length); }