Logo: Relish

  1. Sign in

Project: Tao-of-tdd-trader

Using Trader

Given two files RATES.xml and TRANS.csv respectively:

  1. The first is an XML file containing the conversion rates for exchanging
    one currency with another

  2. The second is a CSV file containing sales data by transaction for an
    international business.

Running trader will output the grand total of sales for the requested item,
in the desired currency.

Scenarios
Usage Instructions
When
I run trader
Then
the output should contain:
USAGE: trader ITEM CURRENCY RATES TRANSACTIONS
  • @wip
Basic Usage

The provided RATES.xml file has a direct mapping of all currencies to each
other.

The search criteria is a single sku value in one or more of the line items
in the TRANS.csv file.

In order to find the desired sum total for a given sku across all stores,
I additionally need to provide the conversion exchange rates, all of the
transactions, and what target currency the sum total must be in.
This allows me to understand how our projects are selling nation wide so
we can better provide what our customers want.

Given
a file named "RATES.xml" with:
<?xml version="1.0"?>
<rates>
  <rate>
    <from>CAD</from>
    <to>USD</to>
    <conversion>1.0090</conversion>
  </rate>
  <rate>
    <from>USD</from>
    <to>CAD</to>
    <conversion>0.9911</conversion>
  </rate>
</rates>
And
a file named "TRANS.csv" with:
store,sku,amount
Yonkers,DM1210,70.00 USD
Yonkers,DM1182,19.68 CAD
Nashua,DM1182,58.58 CAD
Scranton,DM1210,68.76 USD
Camden,DM1182,54.64 USD
When
I run trader DM1182 USD RATES.xml TRANS.csv
Then
the output should contain "133.60"

Last published about 5 years ago by cupakromer.