当前位置: 首页>>代码示例>>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;未经允许,请勿转载。