public virtual Dollars CalculatePrice(CustomerStatus status) { decimal modifier = 1 - status.GetDiscount(); Dollars dollars = GetBasePrice() * modifier; return(dollars); }
public void Dollar_Convert_Number_to_Text() { string value = Dollars.ConvertNumberToText(Convert.ToDecimal(785487)).ToString(); string result = "seven hundred eighty five thousand four hundred eighty seven dollars"; Assert.AreEqual(result.ToLower(), value.ToLower().Trim().Replace(" ", " ")); }
public void SubtractTwoOthersCurrencies() { var first = Dollars.Of(22.50); var second = Zloty.Of(22.50); Assert.Throws <ArgumentException>(() => first - second); }
public void TestDollarEquals() { var dollar1 = Dollars.Parse("5.00"); var dollar2 = Dollars.Parse("5.00"); Assert.IsTrue(dollar1.Equals(dollar2)); }
public void Clear_Order() { Pennies = 0; PenniesText.Text = Pennies.ToString(); Nickles = 0; NicklesText.Text = Nickles.ToString(); Dimes = 0; DimesText.Text = Dimes.ToString(); Quarters = 0; QuartersText.Text = Quarters.ToString(); HalfDollars = 0; HalfDollarsText.Text = HalfDollars.ToString(); Dollars = 0; DollarsText.Text = Dollars.ToString(); Ones = 0; OnesText.Text = Ones.ToString(); Twos = 0; TwosText.Text = Twos.ToString(); Fives = 0; FivesText.Text = Fives.ToString(); Tens = 0; TensText.Text = Tens.ToString(); Twenties = 0; TwentiesText.Text = Twenties.ToString(); Fifties = 0; FiftiesText.Text = Fifties.ToString(); Hundreds = 0; HundredsText.Text = Hundreds.ToString(); TotalBox.Text = 0.00.ToString("C"); }
public void TestMultiplicationInt() { var tenDollars = Dollars.Parse("10.00"); var twoFifty = Dollars.Parse("2.50"); Assert.AreEqual(tenDollars, twoFifty * 4); }
public void TestMultiplicationDecimal() { var tenDollars = Dollars.Parse("10.00"); var twoFifty = Dollars.Parse("2.50"); Assert.AreEqual(twoFifty, tenDollars * 0.25m); }
public void Dollar_Convert_Text_to_Number() { string value = Dollars.ConvertTextToNumber("seven hundred eighty five thousand four hundred eighty seven").ToString(); string result = "785487"; Assert.AreEqual(result, value); }
public void SubtractTwoDollarsTest(double first, double second, double result) { var firstDollar = Dollars.Of(first); var secondDollar = Dollars.Of(second); var resultDollar = Dollars.Of(result); Assert.Equal(resultDollar, firstDollar - secondDollar); }
public void TestDollarGreaterThan() { var dollar1 = Dollars.Parse("1.00"); var dollar2 = Dollars.Parse("2.00"); Assert.IsTrue(dollar2 > dollar1); Assert.IsFalse(dollar1 > dollar2); }
public bool add() { var dollarRate = Dollars.Parse(rate); var newEmployee = new Employee(id, name, payType, dollarRate); payroll.AddEmployee(newEmployee); return(true); }
public Employee(string id, string name, string payType, Dollars payRate) { this.id = id; this.name = name; this.payType = payType; this.payRate = payRate; payments = new Payments(); }
public void PlusEqualsTest() { var dollar1 = Dollars.Parse("1.00"); var dollar2 = Dollars.Parse("2.00"); dollar2 += dollar1; Assert.AreEqual("3.00", dollar2.ToCleanString()); }
public void TestAddition() { var fiveDollars = Dollars.Parse("5.00"); var twoDollars = Dollars.Parse("2.00"); var threeDollars = Dollars.Parse("3.00"); var result = threeDollars + twoDollars; Assert.AreEqual("5.00", result.ToCleanString()); Assert.AreEqual(fiveDollars, result); }
private void Dollars_minus(object sender, RoutedEventArgs e) { if (Dollars - 1 < 0) { return; } Dollars--; DollarsText.Text = Dollars.ToString(); TotalBox.Text = Total.ToString("C"); }
private void btnCalc_Click(object sender, EventArgs e) { if (txtvalue.Text == "") { lblSonuc.Text = "Lütfen Rakam belirtiniz."; } else { lblSonuc.Text = Dollars.ConvertNumberToText(Convert.ToDecimal(txtvalue.Text)).ToString(); } }
private void btnDollarTtoN_Click(object sender, EventArgs e) { if (txtvalue_TtoN.Text == "") { lblSonuc_TtoN.Text = "Lütfen Yazı belirtiniz."; } else { lblSonuc_TtoN.Text = Dollars.ConvertTextToNumber(txtvalue_TtoN.Text).ToString(); } }
public void SalaryTest() { Payroll payroll = new Payroll(); Dollars payrate = Dollars.Parse("4000.00"); Employee carl = new Employee("1", "Carl", "Salary", payrate); payroll.AddEmployee(carl); var payDate = "01/31/2017"; payroll.Pay(payDate); var payment = carl.GetPayment(payDate); Assert.AreEqual("1", carl.GetId()); Assert.AreEqual("3,000.00", payment.GetNetPay().ToCleanString()); Assert.AreEqual(1, payroll.PayCount()); Assert.AreEqual("Carl", payroll.GetEmployee("1").GetName()); }
public virtual Dollars CalculatePrice(AthleteStatus athleteStatus) { decimal discountModifyer = 1 - athleteStatus.GetDiscount(); switch (LicensingModel) { case LicensingModelType.TwoDays: return(Dollars.Of(2) * discountModifyer); case LicensingModelType.ThirtyDays: return(Dollars.Of(4) * discountModifyer); case LicensingModelType.LifeLong: return(Dollars.Of(8) * discountModifyer); default: throw new ArgumentOutOfRangeException(); } }
public void PayEmployee(Employee employee) { Dollars basePay = Dollars.Zero(); var grossPay = Dollars.Zero(); var federalTax = Dollars.Zero(); var netPay = Dollars.Zero(); basePay += employee.GetPayRate(); grossPay += basePay; federalTax = grossPay * FederalTaxRate(); netPay = grossPay - federalTax; var payment = new Payment(payDate, employee.GetId(), employee.GetName()); payment.SetBasePay(basePay); payment.SetGrossPay(grossPay); payment.SetFederalTax(federalTax); payment.SetNetPay(netPay); employee.AddPayment(payment); _payCount++; }
public Dollars Minus(Dollars dollars) { return new Dollars(Amount - dollars.Amount); }
public Dollars Min(Dollars dollars) { return Amount <= dollars.Amount ? this : dollars; }
public Dollars Max(Dollars dollars) { return Amount >= dollars.Amount ? this : dollars; }
public bool IsGreaterThan(Dollars dollars) { return Amount > dollars.Amount; }
public Dollars(Dollars dollars) { Amount = dollars.Amount; }
public void TestDollarCreation() { var dollars = new Dollars(10.00m); Assert.AreEqual("10.00", dollars.ToCleanString()); }
public void TestDollarParse() { var dollars = Dollars.Parse("5.00"); Assert.AreEqual("5.00", dollars.ToCleanString()); }
public void should_fail_to_create_invalid_amount_of_cents() { Result <Dollars> dollar = Dollars.Create(1.11111m); dollar.IsFailure.Should().BeTrue(); }
public void SetFederalTax(Dollars amount) { federalTax = amount; }
public Dollars Plus(Dollars dollars) { return new Dollars(Amount + dollars.Amount); }
private void Dollars_add(object sender, RoutedEventArgs e) { Dollars++; DollarsText.Text = Dollars.ToString(); TotalBox.Text = Total.ToString("C"); }
protected bool Equals(Dollars other) { return Amount.ToString("0.00").Equals(other.Amount.ToString("0.00")); }
public void SetNetPay(Dollars amount) { netPay = amount; }
public void CreateTwoPointPrecisionWithThreePointPrecisionNumberTest() { Assert.Throws <ArgumentException>(() => Dollars.Of(10.501)); }
public void CreateDollarsTest(double value) { CurrencyValue dollars = Dollars.Of(value); Assert.Equal(value, dollars); }
protected override Dollars GetBasePrice() { return(Dollars.Of(8)); }
public void CreateTwoPointPrecisionWitNegativeNumberTest() { Assert.Throws <ArgumentException>(() => Dollars.Of(-10)); }