Ejemplo n.º 1
0
        public ActionResult Listing()
        {
            AuctionsListingViewModel model = new AuctionsListingViewModel();

            model.Auctions = auctionsService.GetAllAuctions();
            return(PartialView(model));
        }
        public void ClearAllAuctions_Always_WillDeleteAllAuctions()
        {
            var auctionToAdd = new Auction()
            {
                AuctionName = "Auction1"
            };

            AuctionsService.AddNewAuction(auctionToAdd);

            AuctionsService.ClearAllAuctions();

            CollectionAssert.IsEmpty(AuctionsService.GetAllAuctions());
        }
        public void AddNewAuction_WhenAddingValidAuction_WillSaveWithNewId()
        {
            var auctionToAdd = new Auction()
            {
                AuctionName = "Auction1"
            };

            AuctionsService.AddNewAuction(auctionToAdd);

            var addedAuction = AuctionsService.GetAllAuctions().Single();

            Assert.AreEqual(1, addedAuction.Id);
        }
        public void AddNewAuction_WhenValidName_WillBeSaved()
        {
            var auctionToAdd = new Auction()
            {
                AuctionName = "Test-Auction"
            };

            AuctionsService.AddNewAuction(auctionToAdd);

            var allAuctions = AuctionsService.GetAllAuctions();

            CollectionAssert.Contains(allAuctions, auctionToAdd);
        }
Ejemplo n.º 5
0
        public ActionResult Index()

        {
            AuctionsService auctionsService = new AuctionsService();
            var             auctions        = auctionsService.GetAllAuctions();

            if (Request.IsAjaxRequest())
            {
                return(PartialView(auctions));
            }
            else
            {
                return(View(auctions));
            }
        }
        public ActionResult Index()
        {
            //AuctionsListingViewModel model = new AuctionsListingViewModel();
            List <Auctions> model = new List <Auctions>();

            model = AuctionsService.GetAllAuctions();
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 7
0
        public ActionResult Index()
        {
            AuctionsViewModel vModel = new AuctionsViewModel();

            vModel.AllAuctions = service.GetAllAuctions();

            vModel.PromotedAuctions = service.GetPromotedAuctions();

            ViewBag.Title = " Home Page";

            ViewBag.MyPageTitle = "Marketplace";



            return(View(vModel));
        }
        public void AddNewAuction_WhenAddingSecondAuction_WillSaveWithNewIdIncreasedBy1()
        {
            var auctionToAdd = new Auction()
            {
                AuctionName = "Auction1"
            };

            AuctionsService.AddNewAuction(auctionToAdd);
            var secondAuctionToAdd = new Auction()
            {
                AuctionName = "Auction2"
            };

            AuctionsService.AddNewAuction(secondAuctionToAdd);

            var lastAddedAuction = AuctionsService.GetAllAuctions().Last(a => a.AuctionName == "Auction2");

            Assert.AreEqual(2, lastAddedAuction.Id);
        }
Ejemplo n.º 9
0
 public IActionResult GetAllAuctions([FromQuery] AuctionListRequestModel request)
 {
     return(Ok(m_auctionsService.GetAllAuctions(request)));
 }