/**
  * @test
  */
 public function itShouldReturnACurrencyPairAfterGettingTheRatioFromTheRepository()
 {
     $currencyFrom = new Currency(Currency::CURRENCY_CODE_EURO);
     $currencyTo = new Currency(Currency::CURRENCY_CODE_US_DOLLAR);
     $ratio = 1.5;
     $this->repository->shouldReceive('findRatio')->andReturn($ratio);
     $expectedCurrencyPair = new CurrencyPair($currencyFrom, $currencyTo, $ratio);
     $currencyPair = $this->service->execute($currencyFrom, $currencyTo);
     $this->assertEquals($expectedCurrencyPair, $currencyPair);
 }
 /**
  * @test
  */
 public function itShouldReturnAValidCurrencyPairGivenTwoCurrencies()
 {
     $currencyFrom = new Currency(Currency::CURRENCY_CODE_EURO);
     $currencyTo = new Currency(Currency::CURRENCY_CODE_US_DOLLAR);
     $request = new GetCurrencyPairRatioRequest($currencyFrom, $currencyTo);
     $expectedCurrencyPair = new CurrencyPair($currencyFrom, $currencyTo, 1.5);
     $this->service->shouldReceive('execute')->andReturn($expectedCurrencyPair);
     $expectedResponse = new GetCurrencyPairRatioResponse($expectedCurrencyPair);
     $response = $this->useCase->execute($request);
     $this->assertEquals($expectedResponse->currencyPair(), $response->currencyPair());
 }
 /**
  * @param GetCurrencyPairRatioRequest $request
  *
  * @return GetCurrencyPairRatioResponse
  */
 public function execute(GetCurrencyPairRatioRequest $request)
 {
     $currencyPair = $this->service->execute($request->currencyFrom(), $request->currencyTo());
     return new GetCurrencyPairRatioResponse($currencyPair);
 }