Changeset 153 for ruby/trunk/lib/models/tests/rm/test_common.rb
- Timestamp:
- Jul 3, 2009, 2:17:43 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/models/tests/rm/test_common.rb
r128 r153 2 2 require 'set' 3 3 require 'rm' 4 5 include OpenEHR::RM::Data_Types::Text 6 include OpenEHR::RM::Common::Resource 7 include OpenEHR::RM::Common::Archetyped 4 8 5 9 class RM_Common_Resource_Test < Test::Unit::TestCase … … 15 19 end 16 20 21 def test_authoured_resource 22 assert_equal 'ja', @authored_resource.original_language 23 end 17 24 end 18 25 … … 31 38 assert_nothing_raised(Exception){ 32 39 @locatable = OpenEHR::RM::Common::Archetyped::Locatable.new('at0001',name,links)} 40 assert_nothing_raised(Exception){ 41 @feeder_audit_details = Feeder_Audit_Details.new(:system_id => 'MAGI')} 33 42 end 34 43 … … 38 47 assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable 39 48 assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable 49 assert_instance_of Feeder_Audit_Details, @feeder_audit_details 40 50 end 41 51 … … 73 83 assert_raise(ArgumentError){@link.type = nil} 74 84 end 85 86 def test_feeder_audit 87 end 88 89 def test_feeder_audit_detail 90 assert_equal 'MAGI', @feeder_audit_details.system_id 91 end 75 92 end 76 93 77 94 class RM_Common_Generic_Test < Test::Unit::TestCase 95 include OpenEHR::RM::Common::Generic 96 include OpenEHR::RM::Support::Identification 97 include OpenEHR::RM::Data_Types::Basic 78 98 def setup 79 # assert_nothing_raised(Exception){@party_proxy = OpenEHR::RM::Common::Generic::Party_Proxy.new} 99 assert_nothing_raised(Exception){party_proxy = Party_Proxy.new} 100 object_id = Object_ID.new('0.0.4') 101 party_ref = Party_Ref.new('unknown', 'ORGANISATION', object_id) 102 assert_nothing_raised(Exception){ 103 @party_proxy = Party_Proxy.new(:external_ref => party_ref)} 104 assert_nothing_raised(Exception){party_self = Party_Self.new} 105 assert_nothing_raised(Exception){ 106 @party_self = Party_Self.new(:external_ref => party_ref)} 107 assert_raise(ArgumentError){ 108 party_identified = Party_Identified.new} 109 identifiers = [] 110 identifiers << DV_Identifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER') 111 identifiers << DV_Identifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER') 112 identifiers << DV_Identifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER') 113 assert_nothing_raised(Exception){ 114 @party_identified = Party_Identified.new(:name => 'NERV', 115 :external_ref => party_ref, 116 :identifier => identifiers)} 80 117 # change_type = OpenEHR::RM::Data_Types::Text::DV_Text.new('audit_type') 81 118 # time_committed = OpenEHR::RM::Data_Types::Quantity::Date_Time::DV_Date_Time.new(2008) 82 119 # assert_nothing_raised(Exception){@audit_details = OpenEHR::RM::Common::Generic::Audit_Details.new('rails',@party_proxy, change_type, time_committed)} 83 120 end 121 84 122 def test_init 123 assert_instance_of Party_Proxy, @party_proxy 124 assert_instance_of Party_Self, @party_self 125 assert_instance_of Party_Identified, @party_identified 126 end 127 128 def test_party_proxy 129 assert_equal 'unknown', @party_proxy.external_ref.namespace 130 end 131 132 def test_party_self 133 assert_equal 'ORGANISATION', @party_self.external_ref.type 134 end 135 136 def test_party_identified 137 assert_equal 'NERV', @party_identified.name 138 assert_equal '0.0.4', @party_identified.external_ref.id.value 139 identifiers = @party_identified.identifier 140 ids = [ ] 141 identifiers.each do |id| 142 ids << id.id 143 end 144 assert_equal %w[MELCHIOR CASPER BALTHAZAR], ids 85 145 end 86 146 end
Note:
See TracChangeset
for help on using the changeset viewer.