source: ruby/branches/0.5/test/unit/lib/open_ehr/rm/data_structures/tc_item_structure.rb@ 190

Last change on this file since 190 was 190, checked in by KOBAYASHI, Shinji, 15 years ago

refs #54

File size: 1.3 KB
Line 
1# refs #54
2include OpenEhr::RM::DataStructures::ItemStructure
3include OpenEhr::RM::DataStructures::ItemStructure::Representation
4include OpenEhr::RM::DataTypes::Text
5
6class TestItemStructre < Test::Unit::TestCase
7 def setup
8 name = DvText.new('item structure')
9 @item_structure = ItemStructure.new(:name => name,
10 :archetype_node_id => 'test')
11 end
12
13 def test_init
14 assert_instance_of ItemStructure, @item_structure
15 end
16end
17
18class TestItemSingle < Test::Unit::TestCase
19 def setup
20 name = DvText.new('test_element')
21 @element = Element.new(:name => name,
22 :archetype_node_id => 'test_element')
23 item_single_name = DvText.new('item single')
24 @item_single = ItemSingle.new(:name => item_single_name,
25 :archetype_node_id => 'test',
26 :item => @element)
27 end
28
29 def test_init
30 assert_instance_of ItemSingle, @item_single
31 end
32
33 def test_element
34 assert_equal @element, @item_single.item
35 end
36
37 def test_as_hierarchy
38 @item_single.item = @element
39 assert_equal 'test_element', @item_single.as_hierarchy.name.value
40 end
41
42 def test_item_valid
43 invalid_element = nil
44 assert_raise(ArgumentError){@item_single.item = invalid_element}
45 end
46end
Note: See TracBrowser for help on using the repository browser.