public void Test_Delete_Bet()
        {
            int idOfDeletedbet = 1;

            betService.DeleteBet(idOfDeletedbet);
            Assert.IsEmpty(context.Bets.Where(p => p.Id == idOfDeletedbet));
        }
예제 #2
0
        public ActionResult Delete(int betID, decimal amount)
        {
            User loggedInUser = (User)Session["LoggedInUser"];

            bool isDeleted = betservice.DeleteBet(betID, amount, loggedInUser);

            return(RedirectToAction("BetList"));
        }
예제 #3
0
        public void CanDeleteBet()
        {
            var mockEvent  = Common.CreateAndSaveMockEvent(EventController);
            var mockMarket = Common.CreateAndSaveMockMarket(mockEvent.Id, "Market Desc", 0.5m, MarketController);

            var newBet = BetService.CreateBet(new Bet()
            {
                BetAmount = 100, MarketId = mockMarket.Id
            });

            BetService.DeleteBet(newBet.Id);
            Assert.Empty(BetService.GetAll());
        }
예제 #4
0
        public void DeleteBet()
        {
            //initiallizing
            var bet        = new Bet();
            var unitOfWork = new Mock <IUnitOfWork>();
            var finder     = new Mock <IBetFinder>();
            var collection = new Mock <IRepository <Bet> >();

            var service = new BetService(unitOfWork.Object, finder.Object, collection.Object);

            //act
            collection.Setup(x => x.Delete(bet))
            .Returns(new Bet());

            service.DeleteBet(bet);

            //assert
            collection.Verify(x => x.Delete(bet), Times.Once);
        }