Class: ODDB::State::User::TestFiPiOffer

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_state/user/fipi_offer_input.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



14
15
16
# File 'test/test_state/user/fipi_offer_input.rb', line 14

def setup
  @offer = FiPiOfferInput::FiPiOffer.new
end

- (Object) test_calculate_activation_charge



57
58
59
# File 'test/test_state/user/fipi_offer_input.rb', line 57

def test_calculate_activation_charge
  assert_equal(2500, @offer.calculate_activation_charge)
end

- (Object) test_calculate_fi_update



60
61
62
63
64
65
66
67
68
# File 'test/test_state/user/fipi_offer_input.rb', line 60

def test_calculate_fi_update
  assert_equal(0, @offer.calculate_fi_update)
  @offer.fi_quantity = 1
  @offer.fi_update = 'update_ywesee'
  assert_equal(150, @offer.calculate_fi_update)
  @offer.fi_quantity = 3
  @offer.fi_update = 'update_ywesee'
  assert_equal(450, @offer.calculate_fi_update)
end

- (Object) test_calculate_pi_update



69
70
71
72
73
74
75
76
77
# File 'test/test_state/user/fipi_offer_input.rb', line 69

def test_calculate_pi_update
  assert_equal(0, @offer.calculate_pi_update)
  @offer.pi_quantity = 1
  @offer.pi_update = 'update_ywesee'
  assert_equal(90, @offer.calculate_pi_update)
  @offer.pi_quantity = 3
  @offer.pi_update = 'update_ywesee'
  assert_equal(270, @offer.calculate_pi_update)
end

- (Object) test_fi_quantity



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'test/test_state/user/fipi_offer_input.rb', line 17

def test_fi_quantity
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = 2
  assert_equal(2, @offer.fi_quantity)
  @offer.fi_quantity = "3"
  assert_equal(3, @offer.fi_quantity)
  @offer.fi_quantity = ""
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = "0"
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = 0
  assert_equal(0, @offer.fi_quantity)
end

- (Object) test_fi_update_charge



43
44
45
46
47
48
49
# File 'test/test_state/user/fipi_offer_input.rb', line 43

def test_fi_update_charge
  assert_equal(0, @offer.fi_update_charge)
  @offer.fi_update = 'update_ywesee'
  assert_equal(@offer.class::FI_UPDATE, @offer.fi_update_charge)
  @offer.fi_update = 'update_adsf'
  assert_equal(0, @offer.fi_update_charge)
end

- (Object) test_pi_quantity



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'test/test_state/user/fipi_offer_input.rb', line 30

def test_pi_quantity
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = 2
  assert_equal(2, @offer.fi_quantity)
  @offer.fi_quantity = "3"
  assert_equal(3, @offer.fi_quantity)
  @offer.fi_quantity = ""
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = "0"
  assert_equal(0, @offer.fi_quantity)
  @offer.fi_quantity = 0
  assert_equal(0, @offer.fi_quantity)
end

- (Object) test_pi_update_charge



50
51
52
53
54
55
56
# File 'test/test_state/user/fipi_offer_input.rb', line 50

def test_pi_update_charge
  assert_equal(0, @offer.fi_update_charge)
  @offer.fi_update = 'update_ywesee'
  assert_equal(@offer.class::FI_UPDATE, @offer.fi_update_charge)
  @offer.fi_update = 'update_adsf'
  assert_equal(0, @offer.fi_update_charge)
end