當前位置: 首頁>>代碼示例>>C#>>正文


C# Account.TransferFunds方法代碼示例

本文整理匯總了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);
 }
開發者ID:EBojilova,項目名稱:CSharpHQC,代碼行數:7,代碼來源:TestAccount.cs

示例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);
	}
開發者ID:Alex223124,項目名稱:High-Quality-Code,代碼行數:10,代碼來源:TestAccount.cs

示例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));
        }
開發者ID:pyonhae,項目名稱:tutorial_nunit,代碼行數:13,代碼來源:AccountTest.cs

示例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);
    }
開發者ID:EBojilova,項目名稱:CSharpHQC,代碼行數:14,代碼來源:TestAccount.cs

示例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));
        }
開發者ID:pyonhae,項目名稱:tutorial_nunit,代碼行數:18,代碼來源:AccountTest.cs

示例6: TestTransferFundsToNullAccount

	public void TestTransferFundsToNullAccount()
	{
		Account source = new Account();
		source.Deposit(200.00F);
		Account dest = null;
		source.TransferFunds(dest, 100.00F);
	}
開發者ID:Alex223124,項目名稱:High-Quality-Code,代碼行數:7,代碼來源:TestAccount.cs

示例7: TestTransferFundsSameAccount

 public void TestTransferFundsSameAccount()
 {
     Account source = new Account();
     source.Deposit(200.00M);
     Account dest = source;
     source.TransferFunds(dest, 100.00M);
 }
開發者ID:premiera85,項目名稱:Software-University,代碼行數:7,代碼來源:AccountTest.cs


注:本文中的Account.TransferFunds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。