Ignore:
Timestamp:
Jul 3, 2009, 2:17:43 AM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #62, #47, #65

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/tests/rm/test_common.rb

    r128 r153  
    22require 'set'
    33require 'rm'
     4
     5include OpenEHR::RM::Data_Types::Text
     6include OpenEHR::RM::Common::Resource
     7include OpenEHR::RM::Common::Archetyped
    48
    59class RM_Common_Resource_Test < Test::Unit::TestCase
     
    1519  end
    1620
     21  def test_authoured_resource
     22    assert_equal 'ja', @authored_resource.original_language
     23  end
    1724end
    1825
     
    3138    assert_nothing_raised(Exception){
    3239      @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')}
    3342  end
    3443
     
    3847    assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable
    3948    assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable
     49    assert_instance_of Feeder_Audit_Details, @feeder_audit_details
    4050  end
    4151
     
    7383    assert_raise(ArgumentError){@link.type = nil}
    7484  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
    7592end
    7693
    7794class 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
    7898  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)}
    80117#    change_type = OpenEHR::RM::Data_Types::Text::DV_Text.new('audit_type')
    81118#    time_committed = OpenEHR::RM::Data_Types::Quantity::Date_Time::DV_Date_Time.new(2008)
    82119#    assert_nothing_raised(Exception){@audit_details = OpenEHR::RM::Common::Generic::Audit_Details.new('rails',@party_proxy, change_type, time_committed)}
    83120  end
     121
    84122  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
    85145  end
    86146end
Note: See TracChangeset for help on using the changeset viewer.