public void BetRepository_Delete_DeletesBet() { var mockDbSet = UnitTestHelper.GetMockDbSet <Bet>(GetTestBets()); var mockContext = GetMockContext(mockDbSet); var betRepo = new BetRepository(mockContext.Object); var bet = new Bet { Id = 1, BetDate = new DateTime(2020, 11, 04), LotId = 1 }; betRepo.Delete(bet); mockDbSet.Verify( m => m.Remove(It.Is <Bet>( l => l.Id == bet.Id && l.BetDate == bet.BetDate && l.LotId == bet.LotId)), Times.Once); }
public bool DeleteBet(int betID, decimal amount, User user) { int isAuthorized = betrep.DeleteBetValidation(user.UserID, betID); bool success; if (isAuthorized != 0) { success = betrep.Delete(betID); if (success == true) { userservice = new UserService(); userservice.AddFunds(user, amount); } } else { success = false; } return(success); }
public void DeleteBet(string betId) { BetRepository.Delete(betId); }