Example #1
0
        public void Find_FindsSell_TransactionInDatabase_Sell_Transaction()
        {
            DateTime         dt = new DateTime(2008, 3, 9, 16, 5, 7);
            Sell_Transaction testSell_Transaction = new Sell_Transaction(1, 2, "a", dt, "b", 3, 0);

            testSell_Transaction.Save();
            Sell_Transaction result = Sell_Transaction.Find(testSell_Transaction.GetId());

            Assert.AreEqual(testSell_Transaction, result);
        }
Example #2
0
        public IActionResult Index()
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();
            List <Sell_Transaction>     allSellTransactions = Sell_Transaction.GetAll();
            List <Game> allGames = Game.GetAll();

            dict.Add("allGames", allGames);
            dict.Add("allSellTransactions", allSellTransactions);
            ViewBag.Dictionary = dict;
            return(View("WantToBuy"));
        }
Example #3
0
        public void Delete_DeleteRemovesSell_Transaction_Sell_TransactionList()
        {
            DateTime         dt = new DateTime(2008, 3, 9, 16, 5, 7);
            Sell_Transaction testSell_Transaction = new Sell_Transaction(1, 2, "a", dt, "b", 3, 0);

            testSell_Transaction.Save();
            testSell_Transaction.Delete();
            List <Sell_Transaction> testList = new List <Sell_Transaction> {
            };
            List <Sell_Transaction> result   = Sell_Transaction.GetAll();

            CollectionAssert.AreEqual(testList, result);
        }
Example #4
0
        public void Save_SavesToDatabase_Sell_TransactionList()
        {
            DateTime         dt = new DateTime(2008, 3, 9, 16, 5, 7);
            Sell_Transaction testSell_Transaction = new Sell_Transaction(1, 2, "a", dt, "b", 3, 0);

            testSell_Transaction.Save();
            List <Sell_Transaction> result   = Sell_Transaction.GetAll();
            List <Sell_Transaction> testList = new List <Sell_Transaction> {
                testSell_Transaction
            };

            CollectionAssert.AreEqual(testList, result);
        }
Example #5
0
        public ActionResult GameDetails(int id)
        {
            Dictionary <string, object> dict   = new Dictionary <string, object>();
            Sell_Transaction            thisST = Sell_Transaction.Find(id);
            List <Game> allGames    = Game.GetAll();
            Game        thisGame    = Game.Find(thisST.GetGameId());
            Game        gameDetails = Game.Find(id);

            dict.Add("thisST", thisST);
            dict.Add("allGames", allGames);
            dict.Add("thisGame", thisGame);
            dict.Add("gameDetails", gameDetails);
            ViewBag.Dictionary = dict;
            return(View());
        }
Example #6
0
        public void Edit_EditChangesSell_Transaction_Sell_Transaction()
        {
            DateTime         dt  = new DateTime(2008, 3, 9, 16, 5, 7);
            DateTime         dt2 = new DateTime(2008, 1, 2, 3, 4, 5);
            Sell_Transaction testSell_Transaction = new Sell_Transaction(1, 2, "a", dt, "b", 3, 0);

            testSell_Transaction.Save();
            testSell_Transaction.Edit(4, 5, "c", dt2, "d", 6);
            Sell_Transaction result = Sell_Transaction.Find(testSell_Transaction.GetId());

            Assert.AreEqual(4, result.GetGameId());
            Assert.AreEqual(5, result.GetUserIdSeller());
            Assert.AreEqual("c", result.GetStatus());
            Assert.AreEqual(dt2, result.GetDate());
            Assert.AreEqual("d", result.GetGamePhoto());
            Assert.AreEqual(6, result.GetUserIdBuyer());
        }
Example #7
0
        public void GetAll_DatabaseEmptyAtFirst_0()
        {
            int result = Sell_Transaction.GetAll().Count;

            Assert.AreEqual(0, result);
        }
Example #8
0
 public void Dispose()
 {
     Sell_Transaction.DeleteAll();
 }