コード例 #1
0
        public void CalculateProfit()
        {
            IAccountingCalculator calc = new AccountingCalculator();
            decimal net = calc.CalculateNet(1000m, 1000m);

            Assert.AreEqual(1000000m, net);
        }
コード例 #2
0
        protected void btnDisplayTotals_Click(object sender, EventArgs e)
        {
            try
            {
                decimal revenue = decimal.Parse(txtRevenue.Text);
                decimal expenses = decimal.Parse(txtExpenses.Text);

                IAccountingCalculator calculator = new AccountingCalculator();
                decimal net = calculator.CalculateNet(revenue, expenses);

                litNet.Text = net.ToString("C");
                pnlError.Visible = false;
            }
            catch
            {
                pnlError.Visible = true;
            }
        }
コード例 #3
0
 public void NegativeRevenue()
 {
     IAccountingCalculator calc = new AccountingCalculator();
     decimal net = calc.CalculateNet(-1000m, 1000m);
 }
コード例 #4
0
 public void NegativeExpenses()
 {
     IAccountingCalculator calc = new AccountingCalculator();
     decimal net = calc.CalculateNet(1000m, -1000m);
 }