public void InsertTest() { //Arrange gameTableDB = new GameTableDB(); bool found = false; var table = new GameTableModel("TestTable"); table.DeckId = 2; //Act gameTableDB.Insert(table); List <GameTableModel> gameTables = gameTableDB.GetAll().ToList(); for (int i = 0; i < gameTables.Count && !found; i++) { if (gameTables[i].TableName == table.TableName) { table.Id = gameTables[i].Id; } } var tableT = gameTableDB.GetById(table.Id); //Assert Assert.AreEqual(table.TableName, tableT.TableName); //Cleanup gameTableDB.Delete(table); }
public static Game ConvertFromGameModelToGame(GameModel gameModel) { IGameTableDBIF gameTableDB = new GameTableDB(); GameTableModel gameTableModel = gameTableDB.GetById(gameModel.GameTableId); Game game = new Game() { Id = gameModel.Id, gameTable = GameTableConverter.ConvertFromGameTableModelToGameTable(gameTableModel) }; return(game); }
public void GetbyIdTest() { gameTableDB = new GameTableDB(); GameTableModel table = null, table2 = null; List <GameTableModel> gameTables = gameTableDB.GetAll().ToList(); if (gameTables.Count > 0) { table = gameTables[0]; } table2 = gameTableDB.GetById(table.Id); Assert.AreEqual(table2.Id, table.Id); }
public void DeleteTest() { gameTableDB = new GameTableDB(); List <GameTableModel> gameTables = gameTableDB.GetAll().ToList(); bool found = false; GameTableModel table = new GameTableModel { DeckId = 2, TableName = "TestTable" }; for (int i = 0; i < gameTables.Count && !found; i++) { if (gameTables[i].TableName == table.TableName) { table.Id = gameTables[i].Id; } } var table1 = gameTableDB.GetById(table.Id); gameTableDB.Delete(table); table = gameTableDB.GetById(table.Id); Assert.IsNull(table); }
public void DeleteGameTableTest() { // arrange gameTableManagement = new GameTableManagement(); IGameTableDBIF tableDB = new GameTableDB(); ICGUserDBIF userDB = new CGUserDB(); CGUser user = CGUserConverter.convertFromCGUserModelToCGUser(userDB.GetById("Test")); gameTableManagement.CreateGameTable(user, "TestTable"); GameTable table = gameTableManagement.GetGameTableByTableName("TestTable"); //Act gameTableManagement.DeleteGameTable(table.Id); //Assert Assert.IsNull(tableDB.GetById(table.Id)); }