public void DebitWallet_DuplicateDebit_ReturnsStatusCodeAcceptedAndBalance(int coins, string transactionId, HttpStatusCode expHttpCode, int expBalance) { using (var mock = AutoMock.GetLoose()) { Wallet credit = new Wallet { WalletId = new Guid("1d4e7d81-ce9d-457b-b056-0f883baa783d"), TransactionType = Const.Credit, Coins = 1000, TransactionId = "tx123", Version = 1 }; IEnumerable <Wallet> response = new List <Wallet>() { credit }; var walletRepo = new Mock <IWalletRepository>(); walletRepo.Setup(p => p.GetWalletById(It.IsAny <Guid>())).Returns(response); walletRepo.Setup(p => p.AddWalletData(credit)); WalletService walletService = new WalletService(walletRepo.Object); walletService.CreateAndCreditWallet(credit); Wallet debit = new Wallet { WalletId = new Guid("1d4e7d81-ce9d-457b-b056-0f883baa783d"), TransactionType = Const.Debit, Coins = coins, TransactionId = transactionId }; var actual = walletService.DebitWallet(debit); Assert.Equal(expHttpCode, actual.Item1); Assert.Equal(expBalance, actual.Item2); } }