Ignore:
Timestamp:
Aug 11, 2009, 11:19:02 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #53

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/test/unit/lib/open_ehr/rm/data_structures/tc_representation.rb

    r184 r186  
    1 include OpenEhr::RM::DataStructure::Representation
     1# refs #53
     2include OpenEhr::RM::DataStructures::Representation
     3include OpenEhr::RM::DataTypes::Text
     4include OpenEhr::RM::Support::Identification
    25
    3 class TestDataStructureRepresentationItem
     6class TestDataStructuresRepresentationItem < Test::Unit::TestCase
    47  def setup
    5     @item = Item.new
     8    name = DvText.new('BP')
     9    @item = Item.new(:name => name, :archetype_node_id => 'test')
    610  end
    711
     
    1014  end
    1115end
     16
     17class TestDataStructuresRepresentationElement < Test::Unit::TestCase
     18  def setup
     19    name = DvText.new('element')
     20    @element = Element.new(:name => name, :archetype_node_id => 'test')
     21  end
     22
     23  def test_init
     24    assert_instance_of Element, @element
     25  end
     26
     27  def test_is_null_true
     28    assert @element.is_null?
     29  end
     30
     31  def test_value_assign
     32    @element.value = 'test'
     33    assert_equal 'test', @element.value
     34  end
     35
     36  def test_is_null_false
     37    @element.value = 'test'
     38    assert !@element.is_null?
     39  end
     40
     41  def test_null_flavor
     42    terminology_id = TerminologyId.new('openehr')
     43    code_phrase = CodePhrase.new('271', terminology_id)
     44    null_flavor = DvCodedText.new('no information', code_phrase)
     45    @element.null_flavor = null_flavor
     46    assert_equal 'no information', @element.null_flavor.value
     47  end
     48
     49  def test_valid_null_flavor_is_nil
     50    assert_nothing_raised(ArgumentError){@element.null_flavor = nil}
     51  end
     52
     53  def test_invalid_null_flavor_is_not_null_flavor
     54    terminology_id = TerminologyId.new('ICD10')
     55    code_phrase = CodePhrase.new('C92.0', terminology_id)
     56    null_flavor = DvCodedText.new('Acute Myeloid Leukemia', code_phrase)
     57    assert_raise(ArgumentError){@element.null_flavor = null_flavor}
     58  end
     59end
     60
     61
     62
     63
Note: See TracChangeset for help on using the changeset viewer.