public void TestInicialize() { _factory = new RateFactory(); _correctJsonRate = new JsonRate() { From = "EUR", To = "USD", Rate = "0.772" }; _incorrectJsonRate = new JsonRate() { Rate = "0.0.1" }; _emptyJsonRate = new JsonRate() { From = "", To = "", Rate = "" }; }
public object GetRatesByCurrency([FromUri] Rates rate) { object response = string.Empty; try { RateFactory concreteFactory = new ConcreteRateFactory(); IRateFactory rateFactory = concreteFactory.GetRateProvider(rate.Provider); if (rateFactory != null) { response = rateFactory.GetRateValue(rate); } else { response = "Invalid provider type"; } } catch (Exception ex) { response = ex.ToString(); } return(response); }
public RatesRepository(IRateFactory rateFactory) { this.ratesFactory = rateFactory; }
public RatesRepository() { this.ratesFactory = new RateFactory(); }
public CreditCardInterestCalculator() { _rateProvider = new RateFactory(); }
public CreditCardInterestCalculator(IRateFactory rateProvider) { _rateProvider = rateProvider; }
public void init() { _mockRateFactory = MockRepository.GenerateStub <IRateFactory>(); _calculator = new CreditCardInterestCalculator(_mockRateFactory); }