public void CurrencyNameChecker_Check_If_Two_Different_Currency_Names_Are_Not_Equal()
        {
            //Arrange
            CurrencyNameChecker nameChecker = new CurrencyNameChecker();
            string firstCurrencyName        = "USD";
            string secondCurrencyName       = "PLN";
            bool   result;

            //Act
            result = nameChecker.CheckingIfCurrencyNamesAreDifferent(firstCurrencyName, secondCurrencyName);

            //Asert
            Assert.True(result);
        }
        public IActionResult ShowResultCurrencyConversion(CurrencyConversionModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("FormOfCurrencyConversion", model));
            }
            if (!_currencyNameChecker.CheckingIfCurrencyNamesAreDifferent(model.FirstCurrency, model.SecondCurrency))
            {
                ViewBag.ResultChekingCurrencyNameInConversion = "Currencies name must different";
                return(View("FormOfCurrencyConversion", model));
            }
            if (!_dateChecker.CheckingIfDateExistsForTwoCurrencies(model.Date, model.FirstCurrency, model.SecondCurrency))
            {
                ViewBag.DateRangeForConversion = _dateRange.GetDateRangeTwoCurrencies(model.FirstCurrency, model.SecondCurrency);

                return(View("FormOfCurrencyConversion", model));
            }
            return(View(_currencyConversionService.CalculateAmountForCurrencyConversion(model)));
        }
예제 #3
0
        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)));
        }