/// <summary> /// 获得选票 /// </summary> public void EarnVote(Model.TourMembership user, Model.EarnWay way) { UserVoteAmount uva = new UserVoteAmount() { User = user, Amount = dalearnway.GetAmountByWay(way)[0].Amount, EarnWay = way, EarnDate = DateTime.Now }; dalvote.EarnVote(uva); }
/// <summary> /// 获取选票 /// </summary> //[Test] public void EarnVotes() { long votesAmount1 = dalUserVoteAmount.GetTotalAmount(memberId); TourMembership u = new TourMembership(); u.Id = memberId; //1 赢得选票 UserVoteAmount uservote = new UserVoteAmount(); uservote.Amount = 4; uservote.EarnDate = DateTime.Now; uservote.EarnWay = EarnWay.BuyDigitalCard; uservote.User = u; dalUserVoteAmount.EarnVote(uservote); //2 获得总票数 long votesAmount2 = dalUserVoteAmount.GetTotalAmount(memberId); Assert.AreEqual(votesAmount1 + 4, votesAmount2); }