Bio-MAGE
view release on metacpan or search on metacpan
t/ConcentrationUnit.t view on Meta::CPAN
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'M'),
'unitNameCV accepts M');
# test setter accepts enumerated value: mM
eval {$concentrationunit->setUnitNameCV('mM')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mM'),
'unitNameCV accepts mM');
# test setter accepts enumerated value: uM
eval {$concentrationunit->setUnitNameCV('uM')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'uM'),
'unitNameCV accepts uM');
# test setter accepts enumerated value: nM
eval {$concentrationunit->setUnitNameCV('nM')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'nM'),
'unitNameCV accepts nM');
# test setter accepts enumerated value: pM
eval {$concentrationunit->setUnitNameCV('pM')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'pM'),
'unitNameCV accepts pM');
# test setter accepts enumerated value: fM
eval {$concentrationunit->setUnitNameCV('fM')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'fM'),
'unitNameCV accepts fM');
# test setter accepts enumerated value: mg_per_mL
eval {$concentrationunit->setUnitNameCV('mg_per_mL')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mg_per_mL'),
'unitNameCV accepts mg_per_mL');
# test setter accepts enumerated value: mL_per_L
eval {$concentrationunit->setUnitNameCV('mL_per_L')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mL_per_L'),
'unitNameCV accepts mL_per_L');
# test setter accepts enumerated value: g_per_L
eval {$concentrationunit->setUnitNameCV('g_per_L')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'g_per_L'),
'unitNameCV accepts g_per_L');
# test setter accepts enumerated value: gram_percent
eval {$concentrationunit->setUnitNameCV('gram_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'gram_percent'),
'unitNameCV accepts gram_percent');
# test setter accepts enumerated value: mass_per_volume_percent
eval {$concentrationunit->setUnitNameCV('mass_per_volume_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mass_per_volume_percent'),
'unitNameCV accepts mass_per_volume_percent');
# test setter accepts enumerated value: mass_per_mass_percent
eval {$concentrationunit->setUnitNameCV('mass_per_mass_percent')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'mass_per_mass_percent'),
'unitNameCV accepts mass_per_mass_percent');
# test setter accepts enumerated value: other
eval {$concentrationunit->setUnitNameCV('other')};
ok((not $@ and $concentrationunit->getUnitNameCV() eq 'other'),
'unitNameCV accepts other');
# retrieve the list of association meta-data
my %assns = Bio::MAGE::Measurement::ConcentrationUnit->associations();
# set the association values in the call to new()
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$concentrationunit = Bio::MAGE::Measurement::ConcentrationUnit->new(propertySets => [Bio::MAGE::NameValueType->new()]);
}
my ($end, $assn);
# testing association propertySets
my $propertysets_assn;
{
# silence the abstract class warnings
local $SIG{__WARN__} = sub {'IGNORE'};
$propertysets_assn = Bio::MAGE::NameValueType->new();
}
ok((UNIVERSAL::isa($concentrationunit->getPropertySets,'ARRAY')
and scalar @{$concentrationunit->getPropertySets} == 1
and UNIVERSAL::isa($concentrationunit->getPropertySets->[0], q[Bio::MAGE::NameValueType])),
'propertySets set in new()');
ok(eq_array($concentrationunit->setPropertySets([$propertysets_assn]), [$propertysets_assn]),
'setPropertySets returns correct value');
ok((UNIVERSAL::isa($concentrationunit->getPropertySets,'ARRAY')
and scalar @{$concentrationunit->getPropertySets} == 1
and $concentrationunit->getPropertySets->[0] == $propertysets_assn),
'getPropertySets fetches correct value');
is($concentrationunit->addPropertySets($propertysets_assn), 2,
'addPropertySets returns number of items in list');
ok((UNIVERSAL::isa($concentrationunit->getPropertySets,'ARRAY')
and scalar @{$concentrationunit->getPropertySets} == 2
and $concentrationunit->getPropertySets->[0] == $propertysets_assn
and $concentrationunit->getPropertySets->[1] == $propertysets_assn),
'addPropertySets adds correct value');
# test setPropertySets throws exception with non-array argument
eval {$concentrationunit->setPropertySets(1)};
ok($@, 'setPropertySets throws exception with non-array argument');
# test setPropertySets throws exception with bad argument array
eval {$concentrationunit->setPropertySets([1])};
( run in 1.742 second using v1.01-cache-2.11-cpan-39bf76dae61 )