Finance-Bank-SentinelBenefits-Csv401kConverter

 view release on metacpan or  search on metacpan

t/line.t  view on Meta::CPAN

use Test::More tests => 20;

use Modern::Perl;

use DateTime;
use lib './lib';

use_ok( 'Finance::Bank::SentinelBenefits::Csv401kConverter::Line' );

my $date = DateTime->new( year   => 1964,
                       month  => 10,
                       day    => 16,
                     );
diag( 'Testing deferral' );
{
    my $l = Finance::Bank::SentinelBenefits::Csv401kConverter::Line->new(
	'date' => $date,
	'symbol' => 'INTC',
	'memo' => 'foobar',
	'price' => 11.24,
	'quantity' => 2,
	'total' => 22.48,
	side   => 'Buy',
	'source' => 'Deferral',
);

    is( 'INTC', $l->symbol(), 'Symbol accessor works' );
    is( 1964, $l->date()->year, 'Date year works' );
    is( 'foobar', $l->memo(), 'Memo accessor works' );
    is( 2, $l->quantity(), 'Quantity accessor works' );
    is( 11.24, $l->price(), 'Price accessor works' );
    is( 22.48, $l->total(), 'Total accessor works' );
    is( 'Deferral', $l->source(), 'Source accessor works' );
    is( 'Buy', $l->side(), 'Side accessor works' );
}

{
    my $l_with_fractional_qty = Finance::Bank::SentinelBenefits::Csv401kConverter::Line->new
      (
       date => $date,
       symbol => 'INTC',
       memo => 'foobar',
       price => 11.24,
       quantity => 2.54,
       total => 22.48,
       source => 'Deferral',
       side => 'Buy'
      );

    is( 2.54, $l_with_fractional_qty->quantity(), 'Quantity accessor works' );
}

diag( 'Testing match' );
{
my $l = Finance::Bank::SentinelBenefits::Csv401kConverter::Line->new
  (
   'date' => $date,
   'symbol' => 'INTC',
   'memo' => 'foobar',
   'price' => 11.24,
   'quantity' => 2,
   'total' => 22.48,
   'source' => 'Match',



( run in 0.670 second using v1.01-cache-2.11-cpan-54e63673c56 )