本文整理汇总了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());
}
示例2: IngredientUsage
public IngredientUsage(Ingredient ingredient, IngredientForm form, Amount amount, string prepnote)
{
Ingredient = ingredient;
Form = form;
Amount = amount;
PrepNote = prepnote;
}
示例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;
}
示例4: IngredientUsage
public IngredientUsage(Ingredient ingredient, IngredientForm form, Amount amount, string preparationNote)
{
this.Ingredient = ingredient;
this.Form = form;
this.Amount = amount;
this.PreparationNote = preparationNote;
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例10: Investment
public Investment(Investor investor, Venture venture, Amount amount)
{
this.investor = investor;
this.venture = venture;
this.Value = amount;
this.venture = venture;
}
示例11: UncontrolledOutput
public UncontrolledOutput(Amount amount, byte[] pkScript) : base(amount)
{
if (pkScript == null)
throw new ArgumentNullException(nameof(pkScript));
PkScript = OutputScript.ParseScript(pkScript);
}
示例12: CashWithdrawnEvent
public CashWithdrawnEvent(Guid id, Balance balance, Amount amount)
{
Id = id;
DateTimeEventOccurred = DateTime.UtcNow;
Balance = balance;
Amount = amount;
}
示例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;
}
示例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;
}
示例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;
}