public void TestGetCardBalance() { //Arrange const string cardNumber = "35434"; const decimal balance = 10052246; var cardInfo = new CardInfo() { CardNumber = cardNumber, IsOperator = false }; _hostProcessorService.RetrieveCardInfo(cardNumber).Returns(cardInfo); _cardProcessor.InsertCard(cardNumber); _hostProcessorService.GetCardBalance(cardNumber).Returns(balance); //Act var result = _cardProcessor.GetCardBalance(); //Assert _hostProcessorService.Received(1).GetCardBalance(Arg.Is(cardNumber)); Assert.Equal(balance, result); }
/// <summary> /// Gets current balance for the inserted card /// </summary> /// <returns>balance</returns> public decimal GetCardBalance() { if (!CardIsAccessible) { throw new CannotAccessCardException(); } return(_hostProcessorService.GetCardBalance(CardInformation.CardNumber)); }