Exemplo n.º 1
0
        public ActionResult RetailerDetails(int id)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Retailer    selectedRetailer      = Retailer.Find(id);
            List <Game> retailerGames         = selectedRetailer.GetGames();
            List <Game> allGames = Game.GetAll();

            model.Add("selectedRetailer", selectedRetailer);
            model.Add("retailerGames", retailerGames);
            model.Add("allGames", allGames);

            return(View(model));
        }
Exemplo n.º 2
0
        public void Delete_DeletesGameAssociationsFromDatabase_GameList()
        {
            Retailer testRetailer = new Retailer("GameStop", "www.GameStop.com");

            testRetailer.Save();

            Game testGame = new Game("Super Mario 64", "Platformer", "Nintendo 64", 1996, 98);

            testGame.Save();

            testGame.AddRetailer(testRetailer);
            testGame.Delete();

            List <Game> resultRetailerGames = testRetailer.GetGames();
            List <Game> testRetailerGames   = new List <Game> {
            };

            CollectionAssert.AreEqual(testRetailerGames, resultRetailerGames);
        }
Exemplo n.º 3
0
        public void GetGames_ReturnsAllRetailerGames_GameList()
        {
            Retailer testRetailer = new Retailer("GameStop", "www.GameStop.com");

            testRetailer.Save();

            Game testGame = new Game("Super Mario 64", "Platformer", "Nintendo 64", 1996, 98);

            testGame.Save();

            Game testGame2 = new Game("Ocarina of Time", "RPG", "Nintendo 64", 1998, 99);

            testGame2.Save();

            testRetailer.AddGame(testGame);
            List <Game> savedGames = testRetailer.GetGames();
            List <Game> testList   = new List <Game> {
                testGame
            };

            CollectionAssert.AreEqual(testList, savedGames);
        }
Exemplo n.º 4
0
        public void Test_AddGame_AddsGameToRetailer()
        {
            Retailer testRetailer = new Retailer("GameStop", "www.GameStop.com");

            testRetailer.Save();

            Game testGame = new Game("Super Mario 64", "Platformer", "Nintendo 64", 1996, 98);

            testGame.Save();

            Game testGame2 = new Game("Ocarina of Time", "RPG", "Nintendo 64", 1998, 99);

            testGame2.Save();

            testRetailer.AddGame(testGame);
            testRetailer.AddGame(testGame2);

            List <Game> result   = testRetailer.GetGames();
            List <Game> testList = new List <Game> {
                testGame, testGame2
            };

            CollectionAssert.AreEqual(testList, result);
        }