예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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)
            {
            }
        }