本文整理汇总了C#中Account.Deposit方法的典型用法代码示例。如果您正苦于以下问题:C# Account.Deposit方法的具体用法?C# Account.Deposit怎么用?C# Account.Deposit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account.Deposit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
var account = new Account("Jim Johnson");
account.Deposit(500.0);
account.Deposit(300.0);
account.Deposit(550.0);
account.PayInterest();
account.Withdraw(1000.00);
account.Withdraw(1100.00);
}
示例2: TestDeposit
public void TestDeposit()
{
Account acc = new Account();
acc.Deposit(200.00F);
float balance = acc.Balance;
Assert.AreEqual(balance, 200F);
}
示例3: TransferFunds
public static void TransferFunds(Account sourceAccount,
Account destinationAccount,
float amount)
{
sourceAccount.Withdraw(amount);
destinationAccount.Deposit(amount);
}
示例4: TestTransferFundsToNullAccount
public void TestTransferFundsToNullAccount()
{
Account source = new Account();
source.Deposit(200.00F);
Account dest = null;
source.TransferFunds(dest, 100.00F);
}
示例5: TestDepositNegative
public void TestDepositNegative()
{
Account acc = new Account();
acc.Deposit(-150.30F);
float balance = acc.Balance;
Assert.AreEqual(balance, -150.30F);
}
示例6: TestDeposit
public void TestDeposit(double sum)
{
var account = new Account();
account.Deposit(300.0);
Assert.AreEqual(300.0, account.Balance);
}
示例7: TestDeposit
public void TestDeposit()
{
Account acc = new Account();
acc.Deposit(200.00M);
decimal balance = acc.Balance;
Assert.AreEqual(balance, 200.00M);
}
示例8: TestDeposit
public void TestDeposit()
{
var acc = new Account();
acc.Deposit(200.00M);
var balance = acc.Balance;
Assert.AreEqual(balance, 200.00M);
}
示例9: CreateAccount
public static Account CreateAccount(double initialBalance)
{
var newAccount = new Account(++_runningId);
newAccount.Deposit(initialBalance);
return newAccount;
}
示例10: TestDepositNegative
public void TestDepositNegative()
{
var acc = new Account();
acc.Deposit(-150.30M);
var balance = acc.Balance;
Assert.AreEqual(balance, -150.30M);
}
示例11: WithdrawalControllerTest
public WithdrawalControllerTest()
{
var aEventLog = new EventLog();
var aMockRepo = new Mock<IAccountRepository>();
var aAccount = new Account(0, aEventLog);
aAccount.Deposit(10); // seed the account with a positive balance
aMockRepo.Setup(aRepo => aRepo.GetAccount()).Returns(aAccount);
/*********************************************************************************************
build mock data for ControllerContext so that context-dependent properties can be tested
(headers, routing, etc...)
*********************************************************************************************/
var config = new HttpConfiguration();
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/api/account");
var route = config.Routes.MapHttpRoute("DefaultApi", "api/v{version}/{controller}/{id}");
var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "Withdrawal" } });
/*********************************************************************************************
build the Controller (class under test) and initialize it with the ControllerContext
*********************************************************************************************/
_controller = new WithdrawalController(aMockRepo.Object)
{
ControllerContext = new HttpControllerContext(config, routeData, request),
Request = request
};
_controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
}
示例12: TestTransferFundsSameAccount
public void TestTransferFundsSameAccount()
{
var source = new Account();
source.Deposit(200.00F);
var dest = source;
source.TransferFunds(dest, 100.00F);
}
示例13: TestTransferFundsFromNullAccount
public void TestTransferFundsFromNullAccount()
{
Account source = null;
var dest = new Account();
dest.Deposit(200.00F);
source.TransferFunds(dest, 100.00F);
}
示例14: Deposit
protected override Transaction Deposit(Account account, Transfer transfer, string code, string description)
{
var payment = (CardPayment) transfer;
var depositTransaction = account.Deposit(code, description, Settings.Location, new Money(transfer.Currency, transfer.Amount), MoneyConverter);
var paymentLink = new PaymentTransactionLink(depositTransaction, payment.Order);
_paymentTransactionLinkRepository.Create(paymentLink);
return depositTransaction;
}
示例15: Withdraw_NonEmptyAccount_ShouldPass
public void Withdraw_NonEmptyAccount_ShouldPass()
{
var account = new Account();
account.Deposit(3000.0);
account.Withdraw(2000.0);
Assert.AreEqual(1000.0, account.Balance);
}