Class: ODDB::State::Interactions::TestBasketState

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

Defined Under Namespace

Classes: App, Session

Instance Method Summary (collapse)

Instance Method Details

- (Object) test_calculate_interactions



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'test/test_state/interactions/basket.rb', line 33

def test_calculate_interactions
  substance1 = Mock.new('substance1')
  substance2 = Mock.new('substance2')
  connection1 = Mock.new('connection1')
  connection2 = Mock.new('connection2')
  connection3 = ODDB::CyP450InhibitorConnection.new('substance_name')
  substance1.__next(:interaction_connections) { {} } 
  substance2.__next(:interaction_connections) { 
    { 
      'cyp1'  => [ connection1, connection2 ],
      'cyp2'  => [ connection3 ],
    }
  }
  connection1.__next(:substance_name) { '' }
  substance2.__next(:same_as?) { true }
  connection2.__next(:substance_name) { '' }
  substance2.__next(:same_as?) { true }
  substance2.__next(:same_as?) { false }
  session = Session.new
  session.interaction_basket = [ substance1, substance2 ] 
  state = State::Interactions::Basket.new(session, 'model')
  assert_equal(2, state.model.size)
  assert_equal(2, state.model.last.cyp450s.size)
  assert_equal(1, state.model.last.inhibitors.size)
  substance1.__verify
  substance2.__verify
  connection1.__verify
  connection2.__verify
end