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


C# Amount類代碼示例

本文整理匯總了C#中Amount的典型用法代碼示例。如果您正苦於以下問題:C# Amount類的具體用法?C# Amount怎麽用?C# Amount使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Amount類屬於命名空間,在下文中一共展示了Amount類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ToString_3

 public void ToString_3()
 {
    var amt = new Amount("usd", -122M);
                          
    Console.WriteLine(amt);    
    Assert.AreEqual("-122:usd", amt.ToString());    
 }
開發者ID:sergey-msu,項目名稱:nfx,代碼行數:7,代碼來源:AmountTests.cs

示例2: IngredientUsage

 public IngredientUsage(Ingredient ingredient, IngredientForm form, Amount amount, string prepnote)
 {
     Ingredient = ingredient;
     Form = form;
     Amount = amount;
     PrepNote = prepnote;
 }
開發者ID:TeamSullust,項目名稱:Teamwork,代碼行數:7,代碼來源:IngredientUsage.cs

示例3: RelevantTransaction

        public static bool RelevantTransaction(WalletTransaction tx, Account account, out Amount debit, out Amount credit)
        {
            if (tx == null)
                throw new ArgumentNullException(nameof(tx));

            debit = 0;
            credit = 0;
            var relevant = false;

            foreach (var input in tx.Inputs)
            {
                if (input.PreviousAccount == account)
                {
                    relevant = true;
                    debit -= input.Amount;
                }
            }
            foreach (var output in tx.Outputs)
            {
                var controlledOutput = output as WalletTransaction.Output.ControlledOutput;
                if (controlledOutput?.Account == account)
                {
                    relevant = true;
                    credit += output.Amount;
                }
            }

            return relevant;
        }
開發者ID:btcsuite,項目名稱:Paymetheus,代碼行數:29,代碼來源:Accounting.cs

示例4: IngredientUsage

 public IngredientUsage(Ingredient ingredient, IngredientForm form, Amount amount, string preparationNote)
 {
     this.Ingredient = ingredient;
     this.Form = form;
     this.Amount = amount;
     this.PreparationNote = preparationNote;
 }
開發者ID:Derneuca,項目名稱:KitchenPCTeamwork,代碼行數:7,代碼來源:IngredientUsage.cs

示例5: TestAmounts

        public void TestAmounts()
        {
            var amt1 = new Amount(0.5f, 1f, Units.Teaspoon);
             var amt2 = new Amount(0.75f, Units.Pound);

             //Test equals
             Assert.AreEqual(new Amount(0.5f, 1f, Units.Teaspoon), amt1);
             Assert.AreEqual(new Amount(0.75f, Units.Pound), amt2);

             //Test multiplication
             Assert.AreEqual(new Amount(1f, 2f, Units.Teaspoon), amt1*2);
             Assert.AreEqual(new Amount(1.5f, Units.Pound), amt2*2);

             //Test addition
             Assert.AreEqual(new Amount(2.5f, 3f, Units.Teaspoon), amt1 + 2);
             Assert.AreEqual(new Amount(1f, Units.Pound), amt2 + 0.25f);

             Assert.AreEqual(new Amount(1.5f, 4f, Units.Teaspoon), amt1 + new Amount(1f, 3f, Units.Teaspoon));
             Assert.AreEqual(new Amount(1.5f, 2f, Units.Teaspoon), amt1 + new Amount(1f, Units.Teaspoon));
             Assert.AreEqual(new Amount(1f, Units.Pound), amt2 + new Amount(.25f, Units.Pound));

             //Cross unit addition
             Assert.AreEqual(new Amount(1.5f, 4f, Units.Teaspoon), amt1 + new Amount(.5f, 1f, Units.Tablespoon));
             // Assert.AreEqual(new Amount(3.5f, 4f, Units.Teaspoon), amt1 + new Amount(1f, Units.Tablespoon)); //Adding 3tsp
             Assert.AreEqual(new Amount(1f, Units.Pound), amt2 + new Amount(4f, Units.Ounce));

             //Test division
             Assert.AreEqual(new Amount(.25f, .5f, Units.Teaspoon), amt1/2);
             Assert.AreEqual(new Amount(.25f, Units.Pound), amt2/3);

             //Test subtraction
             Assert.AreEqual(new Amount(.25f, .75f, Units.Teaspoon), amt1 - .25f);
             Assert.AreEqual(new Amount(.25f, Units.Pound), amt2 - 0.50f);
        }
開發者ID:Derneuca,項目名稱:KitchenPCTeamwork,代碼行數:34,代碼來源:Units.cs

示例6: RealExTransactionRequest

 protected RealExTransactionRequest(string secret, string merchantId, string account, string orderId, Amount amount, Card card, Comments comments)
     : base(secret, merchantId, account, orderId, comments)
 {
     SignatureProperties = () => new[] { Amount.Value.ToString(), Amount.Currency.CurrencyName(), Card.Number };
     Amount = amount;
     Card = card;
 }
開發者ID:JonCanning,項目名稱:RealEx.NET,代碼行數:7,代碼來源:RealExTransactionRequest.cs

示例7: AddIngredient

        public IngredientAdder AddIngredient(Ingredient ingredient, Amount amount, string prepNote = null)
        {
            var usage = new IngredientUsage(ingredient, null, amount, prepNote);
            var addedIngredient = this.AddIngredientUsage(usage);

            return addedIngredient;
        }
開發者ID:Team-Makev-High-Quality-Code,項目名稱:TEAM--MAKEB--High-Quality-Code-Team-Project,代碼行數:7,代碼來源:IngredientAdder.cs

示例8: ToString_1

 public void ToString_1()
 {
    var amt = new Amount("usd", 12.45M);
                          
    Console.WriteLine(amt);    
    Assert.AreEqual("12.45:usd", amt.ToString());    
 }
開發者ID:sergey-msu,項目名稱:nfx,代碼行數:7,代碼來源:AmountTests.cs

示例9: RealEx3DVerifyRequest

 public RealEx3DVerifyRequest(string secret, string merchantId, string account, string orderId, Amount amount, Card card, string paRes, Comments comments)
     : base(secret, merchantId, account, orderId, amount, card, comments)
 {
     PaRes = paRes;
     Type = "3ds-verifysig";
     IsSecure = true;
 }
開發者ID:JonCanning,項目名稱:RealEx.NET,代碼行數:7,代碼來源:RealEx3DVerifyRequest.cs

示例10: Investment

 public Investment(Investor investor, Venture venture, Amount amount)
 {
     this.investor = investor;
     this.venture = venture;
     this.Value = amount;
     this.venture = venture;
 }
開發者ID:bagheera,項目名稱:Gringotts,代碼行數:7,代碼來源:Investment.cs

示例11: UncontrolledOutput

                public UncontrolledOutput(Amount amount, byte[] pkScript) : base(amount)
                {
                    if (pkScript == null)
                        throw new ArgumentNullException(nameof(pkScript));

                    PkScript = OutputScript.ParseScript(pkScript);
                }
開發者ID:btcsuite,項目名稱:Paymetheus,代碼行數:7,代碼來源:WalletTransaction.cs

示例12: CashWithdrawnEvent

        public CashWithdrawnEvent(Guid id, Balance balance, Amount amount)
        {

            Id = id;
            DateTimeEventOccurred = DateTime.UtcNow;
            Balance = balance;
            Amount = amount;
        }
開發者ID:dpdesi,項目名稱:TopmoveApp,代碼行數:8,代碼來源:CashWithdrawnEvent.cs

示例13: Price

    /// <summary>
    /// Initializes a new instance of the <see cref="Price"/> class.
    /// </summary>
    /// <param name="amount">The amount.</param>
    /// <param name="baseQuantity">The base quantity.</param>
    public Price([NotNull] Amount amount, decimal baseQuantity)
    {
      Assert.ArgumentNotNull(amount, "amount");

      this.amount = amount;
      this.baseQuantity = baseQuantity;
      this.orderableUnitFactorRate = 1;
    }
開發者ID:HydAu,項目名稱:sitecore8ecommerce,代碼行數:13,代碼來源:Price.cs

示例14: ShoppingListItems

 public ShoppingListItems(Guid id, Guid userid, Amount amt, Guid? ingredientId, Guid? recipeId)
 {
     this.ItemId = id;
     this.UserId = userid;
     this.Amount = amt;
     this.Ingredient = ingredientId.HasValue ? Ingredients.FromId(ingredientId.Value) : null;
     this.Recipe = recipeId.HasValue ? Recipes.FromId(recipeId.Value) : null;
 }
開發者ID:Derneuca,項目名稱:KitchenPCTeamwork,代碼行數:8,代碼來源:ShoppingListItems.cs

示例15: UnspentOutput

 public UnspentOutput(Sha256Hash txHash, uint outputIndex, Amount amount, OutputScript pkScript, DateTimeOffset seenTime, bool isFromCoinbase)
 {
     TransactionHash = txHash;
     OutputIndex = outputIndex;
     Amount = amount;
     PkScript = pkScript;
     SeenTime = seenTime;
     IsFromCoinbase = IsFromCoinbase;
 }
開發者ID:tuxcanfly,項目名稱:Paymetheus,代碼行數:9,代碼來源:UnspentOutput.cs


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