public void GetSinglePlayerTest() { //Arrange SwingDataController swingDataController = new SwingDataController(); Player expectedPlayer = swingDataController.GetLeaderboard()[0]; //Act Player singlePlayer = swingDataController.GetSinglePlayer("Kri"); //Assert Assert.AreEqual(expectedPlayer.PlayerId, singlePlayer.PlayerId); }
public void PostPlayerToDatabaseTest() { //Arrange SwingDataController swingDataController = new SwingDataController(); Player playerToBePosted = new Player("Kia", 8, 3500); //Act swingDataController.PostPlayerScore(playerToBePosted); Player expectedPlayerFromDatabase = swingDataController.GetSinglePlayer("Kia"); //Assert Assert.AreEqual(playerToBePosted.PlayerName, expectedPlayerFromDatabase.PlayerName); }
public void DeletePlayerFromDatabaseTest() { //Arrange SwingDataController swingDataController = new SwingDataController(); //Act Player playerToBeDeleted = swingDataController.GetSinglePlayer("Kia"); swingDataController.DeletePlayerFromDB(playerToBeDeleted.PlayerId); Player playerShouldNotExist = swingDataController.GetSinglePlayer(playerToBeDeleted.PlayerName); //Assert try { Assert.AreEqual(playerToBeDeleted.PlayerId, playerShouldNotExist.PlayerId); Assert.Fail(); } catch (Exception e) { } }