本文整理汇总了C#中Account.TransferFunds方法的典型用法代码示例。如果您正苦于以下问题:C# Account.TransferFunds方法的具体用法?C# Account.TransferFunds怎么用?C# Account.TransferFunds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account.TransferFunds方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTransferFundsSameAccount
public void TestTransferFundsSameAccount()
{
var source = new Account();
source.Deposit(200.00F);
var dest = source;
source.TransferFunds(dest, 100.00F);
}
示例2: TestTransferFunds
public void TestTransferFunds()
{
Account source = new Account();
source.Deposit(200.00F);
Account dest = new Account();
dest.Deposit(150.00F);
source.TransferFunds(dest, 100.00F);
Assert.AreEqual(250.00F, dest.Balance);
Assert.AreEqual(100.00F, source.Balance);
}
示例3: TransferFundsWithInsufficientFunds
public void TransferFundsWithInsufficientFunds()
{
Account source = new Account();
source.Deposit(100m);
Account destination = new Account();
destination.Deposit(50m);
TestDelegate invalidTransfer = () => source.TransferFunds(destination, 101m);
Assert.Throws<InsufficientFundsException>(invalidTransfer);
Assert.That(source.Balance, Is.EqualTo(100m));
Assert.That(destination.Balance, Is.EqualTo(50m));
}
示例4: TestDepositWithdrawTransferFunds
public void TestDepositWithdrawTransferFunds()
{
var source = new Account();
source.Deposit(200.00F);
source.Withdraw(100.00F);
var dest = new Account();
dest.Deposit(150.00F);
dest.Withdraw(50.00F);
source.TransferFunds(dest, 100.00F);
Assert.AreEqual(0.00F, source.Balance);
Assert.AreEqual(200.00F, dest.Balance);
}
示例5: TransferFunds
public void TransferFunds()
{
Account source = new Account();
source.Deposit(200m);
Account destination = new Account();
destination.Deposit(150m);
source.TransferFunds(destination, 100m);
// Las aserciones se realizan por medio de la clase estática Assert
// En este caso se trata de una aserción de igualdad por medio del método
// estático AreEqual([valor esperado], [valor obtenido])
Assert.AreEqual(250m, destination.Balance);
// Otra forma de expresar la aserción es utilizando la interfaz
// "fluida" de NUnit, donde el código de la aserción es
// bastante legible.
Assert.That(source.Balance, Is.EqualTo(100m));
}
示例6: TestTransferFundsToNullAccount
public void TestTransferFundsToNullAccount()
{
Account source = new Account();
source.Deposit(200.00F);
Account dest = null;
source.TransferFunds(dest, 100.00F);
}
示例7: TestTransferFundsSameAccount
public void TestTransferFundsSameAccount()
{
Account source = new Account();
source.Deposit(200.00M);
Account dest = source;
source.TransferFunds(dest, 100.00M);
}