public async void ExtremeServicesTests_Get_Local_Extreme_Should_Return_MinValue_3_MaxValue_6_GBP()
        {
            //Arrange
            bool result = false;
            ICurrencyRepository    repository       = CreateICurrencyRepositoryMoq();
            ExtremesServices       extremesServices = CreateExtremeServices(repository);
            LocalExtremeValueModel resultModel      = new LocalExtremeValueModel {
                NameCurrency = _firstCurrencyName,
                StartDate    = new DateTime(_startYear, _startMonth, _startDay + 1),
                EndDate      = new DateTime(_startYear, _startMonth, _startDay + 2)
            };
            LocalExtremeValueModel expectedModel = new LocalExtremeValueModel
            {
                NameCurrency = _firstCurrencyName,
                MinValue     = 3,
                MaxValue     = 6
            };

            //Act
            resultModel = await extremesServices.GetLocalExtremes(resultModel);

            if (resultModel.NameCurrency == expectedModel.NameCurrency && resultModel.MinValue == expectedModel.MinValue &&
                resultModel.MaxValue == expectedModel.MaxValue)
            {
                result = true;
            }

            //Assert
            Assert.True(result);
        }
Exemple #2
0
        public IActionResult ShowLocalExtreme(LocalExtremeValueModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("FormOfLocalExtreme", model));
            }
            if (!_dateChecker.CheckingIfDateExists(model.EndDate, model.NameCurrency) ||
                !_dateChecker.CheckingIfDateExists(model.StartDate, model.NameCurrency))
            {
                ViewBag.DateRangeForLocalExtreme = _dateRange.GetDateRangeCurrency(model.NameCurrency);

                return(View("FormOfLocalExtreme", model));
            }
            return(View(_extremeServices.GetLocalExtremes(model)));
        }