public ActionResult CreateNewDealWithPicture(TemporayDeal deal)
        {
            if (ModelState.IsValid)
            {
                //_repository.UserName = User.Identity.Name;/*Comment for testing*/
                _repository.CreateDealWithImage(deal);

                return(RedirectToAction("ThankYouPostNewDeal", "PubDeals"));
            }

            ViewBag.DayOfWeeK = new SelectList(SearchPreferences.DayOfWeek);
            return(View(deal));
        }
Пример #2
0
        public void Create_Deal_for_specific_Pub_without_Image()
        {
            var repository = new FakeRepository();

            TemporayDeal tpD = new TemporayDeal {
                File = null, FK_Pub = 1, Description = "Any 6 pints 22 euro", Price = 22, PublicationDate = new DateTime(2014, 9, 3, 16, 5, 7, 123), StartDate = new DateTime(2014, 9, 3, 16, 5, 7, 123), EndDate = new DateTime(2014, 10, 15, 16, 5, 7, 123), DayOfWeeK = "Every Thursday", VouchersForSale = 35
            };

            repository.CreateDealWithImage(tpD);
            // a new deal has been added witout creating a dealEEVA
            var actual   = FakeRepository.dealFakeTable.Count();
            var expected = 4;//number of deals after adding new Deal

            Assert.AreEqual(expected, actual);
            FakeRepository.dealFakeTable.RemoveAt(3);//delete deal added
        }