public void TestAddition() { Amount d = this.a50.Add(this.b20).Add(this.c5); Assert.AreEqual("75/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", d.StringRepr()); Assert.AreEqual("80/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", d.Add(new BigInteger("5")).StringRepr()); Assert.AreEqual("80/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", d.Add(5).StringRepr()); }
public void ShouldAddAmount(Amount sut, Amount b) { var test = sut.Value + b.Value; sut.Add(b); sut.Value.Should().Be(test); }
public void WhenUsingAdditionMethodWithDifferentCurrency_ThenThrowException(decimal value1, decimal value2, decimal expected) { var money1 = new Amount(value1, "EUR"); var money2 = new Amount(value2, "USD"); Action action = () => Amount.Add(money1, money2); action.Should().Throw <InvalidCurrencyException>().WithMessage("The requested operation expected the currency*"); }
public void Add_Amount_instances_in_a_Closure_of_operations_style() { var firstAmount = new Amount(new decimal(1), Currency.Euro); var secondAmount = new Amount(new decimal(1), Currency.Euro); var thirdAmount = firstAmount.Add(secondAmount); Check.That(thirdAmount.Quantity).IsEqualTo(new decimal(2)); }
public Result <Balance> Add(Money moneyAdd) { SetAsOf(); return(Amount .Add(moneyAdd) .OnFailure(error => Result.Failure <Balance>(error)) .Map(money => new Balance(money, AsOf))); }
public void Add_ShouldAddGivenAmount() { var amount = new Amount(3, LengthUnits.Meter); var result = amount.Add(new Amount(4, LengthUnits.Meter)); Assert.Equal(new Amount(7, LengthUnits.Meter), result); Assert.NotSame(amount, result); }
public void Accept_Adding_Decimal(decimal value) { _sut = new Amount(1); var result = _sut.Add(value); result.Value.Should() .Be(1 + value); }
public void Accept_Adding_Another_Amount(decimal value) { _sut = new Amount(value); var result = _sut.Add((Amount)value); result.Value.Should() .Be(2 * value); }
public void Throw_exception_when_trying_to_add_Amounts_with_different_currencies() { var firstAmount = new Amount(new decimal(1), Currency.Euro); var secondAmount = new Amount(new decimal(1), Currency.Yuan); Check.ThatCode(() => firstAmount.Add(secondAmount)) .Throws <InvalidOperationException>() .WithMessage("Can't add amounts with different currencies: Amount= 1 Euro and other amount= 1 Yuan."); }
public void WhenUsingAdditionMethodWithDecimal_ThenAmountShouldBeAdded(decimal value1, decimal value2, decimal expected) { _output.WriteLine($"en-US : {CultureInfo.CurrentCulture.Name},{CultureInfo.CurrentUICulture.Name}"); var money1 = new Amount(value1, "EUR"); var result = Amount.Add(money1, value2); result.Should().Be(new Amount(expected, "EUR")); result.Should().NotBeSameAs(money1); }
public void WhenUsingAdditionMethod_ThenAmountShouldBeAdded(decimal value1, decimal value2, decimal expected) { var money1 = new Amount(value1); var money2 = new Amount(value2); var result = Amount.Add(money1, money2); result.Should().Be(new Amount(expected)); result.Should().NotBeSameAs(money1); result.Should().NotBeSameAs(money2); }
public void AddPenalties(int yearOfTransaction, decimal amount, int numOfYears) { var indicesRequired = yearOfTransaction /*2022*/ + numOfYears /*3*/ - StartingYear; // 2025 - 2020 = 5 //if (Amount.Count < indicesRequired) // var addsNeeded = indicesRequired - Amount.Count; for (int x = 0; x < indicesRequired; x++) { //for each addNeeded, add a year to starting year with a 0 amount if (!Amount.ContainsKey((StartingYear + x).ToString())) { Amount.Add((StartingYear + x).ToString(), 0); } } for (int x = 0; x < numOfYears; x++) { Amount[(yearOfTransaction + x).ToString()] += amount; } }
void HandleRotate(RotationGestureRecognizer rotationGesture) { if (rotationGesture.Rotation < 0 && Amount == NSDecimalNumber.Zero) { return; } rotation += rotationGesture.Rotation; Transform = CGAffineTransform.MakeRotation((System.nfloat)rotation); amountIncrementor += rotationGesture.Rotation; if (amountIncrementor < -0.05 || amountIncrementor > 0.05) { NSDecimalNumber change = new NSDecimalNumber(1, 1, amountIncrementor < 0); Amount = Amount.Add(change); amountIncrementor = 0; AmountUpdated?.Invoke(Amount); } }
public PositiveMoney Sum(PositiveMoney amount) { return(Amount.Add(amount)); }
public Money Sum(Money amount) { return(Amount.Add(amount)); }
public void Add(Food item, int amount) { Items.Add(item); Amount.Add(amount); }
public void AddToCart(Food food, int amount) { Items.Add(food); Amount.Add(amount); }
public void Increase(Money money) { Amount = Amount.Add(money); }
public PositiveMoney Sum(PositiveMoney amount) => Amount.Add(amount);
public void Add(string type, int value) { Type.Add(type); Amount.Add(value); totalAmount += value; }
public PositiveAmount Sum(PositiveAmount amount) { return(Amount.Add(amount)); }
public Balance Deposite(Amount amount) { return(new Balance(_amount.Add(amount))); }