public async void ExtremeServicesTests_Get_Global_Extreme_Should_Return_MinValue_2_MaxValue_11_GBP() { //Arrange bool result = false; ICurrencyRepository repository = CreateICurrencyRepositoryMoq(); ExtremesServices extremesServices = CreateExtremeServices(repository); GlobalExtremeValueModel resultModel = new GlobalExtremeValueModel { NameCurrency = _firstCurrencyName }; GlobalExtremeValueModel expectedModel = new GlobalExtremeValueModel { NameCurrency = _firstCurrencyName, MaxValue = 11, MinValue = 2 }; //Act resultModel = await extremesServices.GetGlobalExtreme(resultModel); if (resultModel.NameCurrency == expectedModel.NameCurrency && resultModel.MinValue == expectedModel.MinValue && resultModel.MaxValue == expectedModel.MaxValue) { result = true; } //Assert Assert.True(result); }
public async Task <GlobalExtremeValueModel> GetGlobalExtreme(GlobalExtremeValueModel extremeValue) { List <CurrencyRecord> listOfRecords = await GetCurrencyList(extremeValue.NameCurrency); extremeValue.MaxValue = listOfRecords.Max(c => c.High); extremeValue.MinValue = listOfRecords.Min(c => c.Low); return(extremeValue); }
public GlobalExtremeValueModel GetGlobalExtremes(GlobalExtremeValueModel extremeValue) { List <CurrencyRecord> ListOfRecords = GetCurrencyList(extremeValue.NameCurrency); extremeValue.MaxValue = ListOfRecords.Max(c => c.High); extremeValue.MinValue = ListOfRecords.Min(c => c.Low); return(extremeValue); }
public IActionResult ShowGlobaExtreme(GlobalExtremeValueModel model) { if (!ModelState.IsValid) { return(View("FormOfGlobalExtreme", model)); } return(View(_extremeServices.GetGlobalExtremes(model))); }
public async Task <IActionResult> ShowGlobalExtreme(GlobalExtremeValueModel model) { ViewData["currencyCodes"] = await _currenciesSelectList.GetCurrencyCodes(User.Identity.Name); if (!ModelState.IsValid) { return(View("FormOfGlobalExtreme", model)); } return(View(await _extremeServices.GetGlobalExtreme(model))); }