# refs #53 include OpenEhr::RM::DataStructures::ItemStructure::Representation include OpenEhr::RM::DataTypes::Text include OpenEhr::RM::Support::Identification class TestDataStructuresRepresentationItem < Test::Unit::TestCase def setup name = DvText.new('BP') @item = Item.new(:name => name, :archetype_node_id => 'test') end def test_init assert_instance_of Item, @item end end class TestDataStructuresRepresentationElement < Test::Unit::TestCase def setup name = DvText.new('element') @element = Element.new(:name => name, :archetype_node_id => 'test') end def test_init assert_instance_of Element, @element end def test_is_null_true assert @element.is_null? end def test_value_assign @element.value = 'test' assert_equal 'test', @element.value end def test_is_null_false @element.value = 'test' assert !@element.is_null? end def test_null_flavor terminology_id = TerminologyId.new('openehr') code_phrase = CodePhrase.new('271', terminology_id) null_flavor = DvCodedText.new('no information', code_phrase) @element.null_flavor = null_flavor assert_equal 'no information', @element.null_flavor.value end def test_valid_null_flavor_is_nil assert_nothing_raised(ArgumentError){@element.null_flavor = nil} end def test_invalid_null_flavor_is_not_null_flavor terminology_id = TerminologyId.new('ICD10') code_phrase = CodePhrase.new('C92.0', terminology_id) null_flavor = DvCodedText.new('Acute Myeloid Leukemia', code_phrase) assert_raise(ArgumentError){@element.null_flavor = null_flavor} end end