public void TestMethodTCTDJRTHTS() { var cards = new List <Card> { new Card { Suit = Suit.Club, CardNumber = CardNumber.Ten }, // 10 new Card { Suit = Suit.Diamond, CardNumber = CardNumber.Ten }, // 20 new JokerCard(), // 40 new Card { Suit = Suit.Heart, CardNumber = CardNumber.Ten }, // 30 new Card { Suit = Suit.Spade, CardNumber = CardNumber.Ten } // 40 }; IOperateCard operateCard = new OperateCard(); var actualResult = operateCard.CalculateScore(cards); Assert.AreEqual(200, actualResult); }
public ActionResult Index(string cardList) { if (!cardList.IsNullOrWhiteSpace()) { var inputCards = cardList.Trim().ToUpper().Split(','); var realCards = new RealCards(inputCards); if (realCards.CardValidation.IsSuccess) { var cards = realCards.GetCardList(); IOperateCard operateCard = new OperateCard(); var score = operateCard.CalculateScore(cards); ViewBag.Message = ResultMessage.YourScore + score; View(ViewBag.Message); } else { ViewBag.Message = realCards.CardValidation.Message; View(ViewBag.Message); } } return(View()); }
public void TestMethodJR() { var cards = new List <Card> { new JokerCard() }; IOperateCard operateCard = new OperateCard(); var actualResult = operateCard.CalculateScore(cards); Assert.AreEqual(0, actualResult); }
public void TestMethod2C() { var cards = new List <Card> { new Card { Suit = Suit.Club, CardNumber = CardNumber.Two } }; IOperateCard operateCard = new OperateCard(); var actualResult = operateCard.CalculateScore(cards); Assert.AreEqual(2, actualResult); }
public void TestMethodACADAHAS() { var cards = new List <Card> { new Card { Suit = Suit.Club, CardNumber = CardNumber.Ace }, // 14* 1 = 14 new Card { Suit = Suit.Diamond, CardNumber = CardNumber.Ace }, // 14* 2 = 28 new Card { Suit = Suit.Heart, CardNumber = CardNumber.Ace }, // 14* 3 = 42 new Card { Suit = Suit.Spade, CardNumber = CardNumber.Ace } // 14* 4 = 56 // Total is 140 + Additional 400 }; IOperateCard operateCard = new OperateCard(); var actualResult = operateCard.CalculateScore(cards); Assert.AreEqual(540, actualResult); }