Exemple #1
0
        public async Task GetMultipleVersionsByCalculationId()
        {
            int[] versionIds = new[]
            {
                NewRandomInt(),
                NewRandomInt(),
                NewRandomInt(),
            };
            string calculationId = NewRandomString();

            CalculationVersionsCompareModel expectedRequest = new CalculationVersionsCompareModel
            {
                Versions      = versionIds,
                CalculationId = calculationId
            };

            IEnumerable <CalculationVersion> expectedResponse = Enumerable.Empty <CalculationVersion>();

            GivenTheResponse("calculation-versions", expectedResponse, HttpMethod.Post);

            ApiResponse <IEnumerable <CalculationVersion> > apiResponse = await _client.GetMultipleVersionsByCalculationId(versionIds, calculationId);

            apiResponse?.StatusCode
            .Should()
            .Be(HttpStatusCode.OK);

            apiResponse
            .Content
            .Should()
            .BeEquivalentTo(expectedResponse);

            AndTheRequestContentsShouldHaveBeen(expectedRequest.AsJson());
        }
Exemple #2
0
        public async Task <ApiResponse <IEnumerable <CalculationVersion> > > GetMultipleVersionsByCalculationId(IEnumerable <int> versionIds, string calculationId)
        {
            Guard.ArgumentNotNull(versionIds, nameof(versionIds));
            Guard.IsNullOrWhiteSpace(calculationId, nameof(calculationId));

            CalculationVersionsCompareModel calcsVersGetModel = new CalculationVersionsCompareModel()
            {
                Versions      = versionIds,
                CalculationId = calculationId,
            };

            string url = $"{UrlRoot}/calculation-versions";

            return(await PostAsync <IEnumerable <CalculationVersion>, CalculationVersionsCompareModel>(url, calcsVersGetModel));
        }
Exemple #3
0
 public Task <IActionResult> CalculationVersions([FromBody] CalculationVersionsCompareModel calculationVersionsCompareModel) =>
 _calcsService.GetCalculationVersions(calculationVersionsCompareModel);