示例#1
0
	def testMixedAddition(self):
		fiveBucks = Money.dollar(5)
		tenFrancs = Money.franc(10)
		bank = Bank()
		bank.addRate('CHF', 'USD', 2)
		result = bank.reduce(fiveBucks.plus(tenFrancs), 'USD')
		self.assertEquals(Money.dollar(10), result)
示例#2
0
文件: tests.py 项目: williamsbdev/tdd
 def test_mixed_addition(self):
     five_bucks = Money.dollar(5)
     ten_francs = Money.franc(10)
     bank = Bank()
     bank.add_rate("CHF", "USD", 2)
     result = bank.reduce(five_bucks.plus(ten_francs), "USD")
     self.assertEqual(Money.dollar(10), result)
示例#3
0
 def test_mixed_addition(self):
     five_bucks = Money.dollar(5)
     ten_francs = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     result = bank.reduce(five_bucks.plus(ten_francs), 'USD')
     assert Money.dollar(10) == result
示例#4
0
 def test_simple_addition(self):
     five = Money.dollar(5)
     bank = Bank()
     # reduce:式を単純な形に変形するの意.
     _sum = five.plus(five)
     # Imposterパターン
     reduced = bank.reduce(_sum, "USD")
     self.assertTrue(Money.dollar(10) == reduced)
示例#5
0
	def testSumTimes(self):
		fiveBucks = Money.dollar(5)
		tenFrancs = Money.franc(10)
		bank = Bank()
		bank.addRate('CHF', 'USD', 2)
		sum = Sum(fiveBucks, tenFrancs).times(2)
		result = bank.reduce(sum, 'USD')
		self.assertEquals(Money.dollar(20), result)
示例#6
0
文件: tests.py 项目: williamsbdev/tdd
 def test_sum_times(self):
     five_bucks = Money.dollar(5)
     ten_francs = Money.franc(10)
     bank = Bank()
     bank.add_rate("CHF", "USD", 2)
     _sum = Sum(five_bucks, ten_francs).times(2)
     result = bank.reduce(_sum, "USD")
     self.assertEqual(Money.dollar(20), result)
示例#7
0
 def test_total_times(self):
     five_bucks = Money.dollar(5)
     ten_francs = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     total = Total(five_bucks, ten_francs).times(2)
     result = bank.reduce(total, 'USD')
     assert Money.dollar(20) == result
示例#8
0
 def test_total_plus_money(self):
     five_bucks = Money.dollar(5)
     ten_francs = Money.franc(10)
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     total = Total(five_bucks, ten_francs).plus(five_bucks)
     result = bank.reduce(total, 'USD')
     assert Money.dollar(15) == result
示例#9
0
def test_sum_times():
    five_bucks = Money.dollar(5)
    ten_franc = Money.franc(10)
    bank = Bank()
    bank.add_rate("CHF", "USD", 2)
    expression_sum = Sum(five_bucks, ten_franc).times(2)
    result = bank.reduce(expression_sum, "USD")
    assert result == Money.dollar(20)
示例#10
0
def test_sum_plus_money():
    five_bucks = Money.dollar(5)
    ten_francs = Money.franc(10)
    bank = Bank()
    bank.add_rate("CHF", "USD", 2)
    sum = Sum(five_bucks, ten_francs).plus(five_bucks)
    result = bank.reduce(sum, "USD")
    assert Money.dollar(15) == result
示例#11
0
def test_sum_times():
    five_bucks = Money.dollar(5)
    ten_francs = Money.franc(10)
    bank = Bank()
    bank.add_rate("CHF", "USD", 2)
    sum = Sum(five_bucks, ten_francs).times(2)
    result = bank.reduce(sum, "USD")
    assert Money.dollar(20) == result
示例#12
0
 def test_reduce_sum(self):
     sum = Sum(Money.doller(3), Money.doller(4))
     self.assertIsInstance(sum, Expression)
     bank = Bank()
     result = bank.reduce(sum, "USD")
     self.assertEqual(Money.doller(7), result)
示例#13
0
 def test_simple_addition(self):
     five = Money.doller(5)
     sum: Expression = five.plus(five)
     bank = Bank()
     reduced = bank.reduce(sum, 'USD')
     self.assertEqual(Money.doller(10), reduced)
示例#14
0
def test_reduce_money_different_currency():
    bank = Bank()
    bank.add_rate("CHF", "USD", 2)
    result = bank.reduce(Money.franc(2), "USD")
    assert Money.dollar(1) == result
示例#15
0
def test_reduce_money():
    bank = Bank()
    result = bank.reduce(Money.dollar(1), "USD")
    assert Money.dollar(1) == result
示例#16
0
	def testReduceSum(self):
		sum = Sum(Money.dollar(3), Money.dollar(4))
		bank = Bank()
		result = bank.reduce(sum, 'USD')
		self.assertEquals(Money.dollar(7), result)
示例#17
0
 def test_reduce_sum(self):
     sum = Sum(Money.dollar(3), Money.dollar(4))
     bank = Bank()
     result = bank.reduce(sum, "USD")
     self.assertTrue(Money.dollar(7) == result)
示例#18
0
文件: tests.py 项目: williamsbdev/tdd
 def test_reduce_money(self):
     bank = Bank()
     result = bank.reduce(Money.dollar(1), 'USD')
     self.assertEqual(Money.dollar(1), result)
示例#19
0
def test_reduce_sum():
    sum_expression = Sum(Money.dollar(3), Money.dollar(4))
    bank = Bank()
    result = bank.reduce(sum_expression, "USD")
    assert result == Money.dollar(7)
示例#20
0
def test_simple_addition():
    five = Money.dollar(5)
    sum_expression = five.plus(five)
    bank = Bank()
    reduced = bank.reduce(sum_expression, "USD")
    assert reduced == Money.dollar(10)
示例#21
0
 def test_reduce_money(self):
     bank = Bank()
     result = bank.reduce(Money.dollar(1),"USD")
     self.assertTrue(Money.dollar, result)
示例#22
0
	def testReduceMoneyDifferentCurrency(self):
		bank = Bank()
		bank.addRate('CHF', 'USD', 2)
		result = bank.reduce(Money.franc(2), 'USD')
		self.assertEquals(Money.dollar(1), result)
示例#23
0
	def testReduceMoney(self):
		bank = Bank()
		result = bank.reduce(Money.dollar(1), 'USD')
		self.assertEquals(Money.dollar(1), result)
示例#24
0
文件: tests.py 项目: williamsbdev/tdd
 def test_simple_addition(self):
     five = Money.dollar(5)
     total = five.plus(five)
     bank = Bank()
     reduced = bank.reduce(total, 'USD')
     self.assertEqual(Money.dollar(10), reduced)
示例#25
0
 def test_reduce_total(self):
     total = Total(Money.dollar(3), Money.dollar(4))
     bank = Bank()
     result = bank.reduce(total, 'USD')
     assert Money.dollar(7) == result
示例#26
0
文件: tests.py 项目: williamsbdev/tdd
 def test_reduce_sum(self):
     _sum = Sum(Money.dollar(3), Money.dollar(4))
     bank = Bank()
     result = bank.reduce(_sum, 'USD')
     self.assertEqual(Money.dollar(7), result)
示例#27
0
def test_simple_addition():
    five = Money.dollar(5)
    sum = five.plus(five)
    bank = Bank()
    reduced = bank.reduce(sum, "USD")
    assert Money.dollar(10) == reduced
示例#28
0
文件: tests.py 项目: williamsbdev/tdd
 def test_reduce_money_different_currency(self):
     bank = Bank()
     bank.add_rate("CHF", "USD", 2)
     result = bank.reduce(Money.franc(2), "USD")
     self.assertEqual(Money.dollar(1), result)
示例#29
0
def test_reduce_sum():
    sum = Sum(Money.dollar(3), Money.dollar(4))
    bank = Bank()
    result = bank.reduce(sum, "USD")
    assert Money.dollar(7) == result
示例#30
0
 def test_reduce_money_different_currency(self):
     bank = Bank()
     bank.add_rate('CHF', 'USD', 2)
     result = bank.reduce(Money.franc(2), 'USD')
     assert Money.dollar(1), result
示例#31
0
	def testSimpleAddition(self):
		five = Money.dollar(5)
		sum = five.plus(five)
		bank = Bank()
		reduced = bank.reduce(sum, 'USD')
		self.assertEquals(Money.dollar(10), reduced)