public IActionResult ShowResultCurrencyComparision(CurrenciesComparatorModel model) { if (!ModelState.IsValid) { return(View("FormOfCurrencyComparator", model)); } if (!_currencyNameChecker.CheckingIfCurrencyNamesAreDifferent(model.FirstCurrencyCode, model.SecondCurrencyCode)) { ViewBag.ResultChekingCurrencyNameInComparision = "Currencies name must different"; return(View("FormOfCurrencyComparator", model)); } if (!_dateChecker.CheckingIfDateExistsForTwoCurrencies(model.Date, model.FirstCurrencyCode, model.SecondCurrencyCode)) { ViewBag.DateRangeForComparison = _dateRange.GetDateRangeTwoCurrencies(model.FirstCurrencyCode, model.SecondCurrencyCode); return(View("FormOfCurrencyComparator", model)); } return(View(_currenciesComparator.CompareCurrencies(model))); }
public async void CurrencyNameChecker_1_USD_Should_Be_Worth_Half_Of_AUD() { //Arrange int usdStartValue = 1; int audStartValue = 3; //bool result; CurrenciesComparator currenciesComparator = CreateCurrencyNameChecker(usdStartValue, audStartValue); CurrenciesComparatorModel currenciesComparatorModel = new CurrenciesComparatorModel(); currenciesComparatorModel.FirstCurrencyCode = _firstCurrencyName; currenciesComparatorModel.SecondCurrencyCode = _secondCurrencyName; currenciesComparatorModel.Date = new DateTime(_date.Year, _date.Month, _date.Day + 1); //Act var result = await currenciesComparator.CompareCurrencies(currenciesComparatorModel); //Asert Assert.Equal(($"On the day of {currenciesComparatorModel.Date.ToShortDateString()} {_firstCurrencyName} is worth 0,5 {_secondCurrencyName}").ToLower() , result.ComparatorResult.ToLower()); }