public void Setup() { _baseCalculatorService = new BaseCalculatorService(); _thirdPartyGrv = new ThirdPartyGrv(); _thirdPartyGrvResult = new ThirdPartyGrvResult(); _thirdPartyGrvExpected = new ThirdPartyGrvResult(); }
public CalculateThirdPartyGrvStl13Steps() { _baseUrl = "https://amtcalculator.azurewebsites.net/"; _endPointService = "api/GasbCalculator/CalculateThirdPartyGrvStl13"; _thirdPartyGrvResult = new ThirdPartyGrvResult(); _thirdPartyGrv = new ThirdPartyGrv(); _amtErrorMessage = new AMTErrorMessage(); }
public void Success() { _thirdPartyGrv.PVofGuaranteedRV = 1012.2323M; _thirdPartyGrv.RateImplicit = 2.4332M; _thirdPartyGrv.NetInvLeaseSTL = 983.234M; _thirdPartyGrv.CuUnearnedIntThirdPartyGrvStl = 183M; _thirdPartyGrvExpected.ThirdPartyGrvStl = 1012.23M; _thirdPartyGrvExpected.NetThirdPartyGrvStl = 1014.13M; _thirdPartyGrvExpected.UnearnedIntThirdPartyGrvStl = 184.89M; _thirdPartyGrvExpected.NetInvestmentInLeaseStl = 983.23M; _thirdPartyGrvResult = _baseCalculatorService.CalculateThirdPartyGrvStl13(_thirdPartyGrv); Assert.That(_thirdPartyGrvResult.ThirdPartyGrvStl, Is.EqualTo(_thirdPartyGrvExpected.ThirdPartyGrvStl)); Assert.That(_thirdPartyGrvResult.NetThirdPartyGrvStl, Is.EqualTo(_thirdPartyGrvExpected.NetThirdPartyGrvStl)); Assert.That(_thirdPartyGrvResult.UnearnedIntThirdPartyGrvStl, Is.EqualTo(_thirdPartyGrvExpected.UnearnedIntThirdPartyGrvStl)); Assert.That(_thirdPartyGrvResult.NetInvestmentInLeaseStl, Is.EqualTo(_thirdPartyGrvExpected.NetInvestmentInLeaseStl)); }
public async Task WhenIpostthedatatoCalculateThirdPartyGrvStl13EndPointAsync() { using var httpClient = new HttpClient(); StringContent content = new StringContent(JsonConvert.SerializeObject(_thirdPartyGrv), Encoding.UTF8, "application/json"); using var response = await httpClient.PostAsync(_baseUrl + _endPointService, content); string apiResponse = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { _thirdPartyGrvResult = JsonConvert.DeserializeObject <ThirdPartyGrvResult>(apiResponse); } else { _amtErrorMessage = JsonConvert.DeserializeObject <AMTErrorMessage>(apiResponse); } }