# refs #54 include OpenEhr::RM::DataStructures::ItemStructure include OpenEhr::RM::DataStructures::ItemStructure::Representation include OpenEhr::RM::DataTypes::Text class TestItemStructre < Test::Unit::TestCase def setup name = DvText.new('item structure') @item_structure = ItemStructure.new(:name => name, :archetype_node_id => 'test') end def test_init assert_instance_of ItemStructure, @item_structure end end class TestItemSingle < Test::Unit::TestCase def setup name = DvText.new('test_element') @element = Element.new(:name => name, :archetype_node_id => 'test_element') item_single_name = DvText.new('item single') @item_single = ItemSingle.new(:name => item_single_name, :archetype_node_id => 'test', :item => @element) end def test_init assert_instance_of ItemSingle, @item_single end def test_element assert_equal @element, @item_single.item end def test_as_hierarchy @item_single.item = @element assert_equal 'test_element', @item_single.as_hierarchy.name.value end def test_item_valid invalid_element = nil assert_raise(ArgumentError){@item_single.item = invalid_element} end end