public IRate SaveRate(IJsonRate r) { if (!(_specification.IsSatisfiedBy(r.From) && _specification.IsSatisfiedBy(r.To))) { throw new IncorrectCurrentNameException(); } var rate = new Rate() { FromCurrency = r.From, ToCurrency = r.To, Value = RateStringToInt.RateFormatConverter(r.Rate) }; return(rate); }
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 = "" }; }