source: ruby/branches/0.5/test/unit/lib/open_ehr/rm/data_structures/tc_representation.rb@ 187

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

refs #53 correct directory

File size: 1.6 KB
Line 
1# refs #53
2include OpenEhr::RM::DataStructures::ItemStructure::Representation
3include OpenEhr::RM::DataTypes::Text
4include OpenEhr::RM::Support::Identification
5
6class TestDataStructuresRepresentationItem < Test::Unit::TestCase
7 def setup
8 name = DvText.new('BP')
9 @item = Item.new(:name => name, :archetype_node_id => 'test')
10 end
11
12 def test_init
13 assert_instance_of Item, @item
14 end
15end
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 TracBrowser for help on using the repository browser.