コード例 #1
0
        public void ValidExchangeMappingTest(Scope scope, Label label, Mode mode, ResourceId resource)
        {
            var fileHandler          = new FileUploadManager();
            var mappingHandler       = new MappingManager();
            var exchangeQueueHandler = new QueueManager();
            var requestMappingUpdate = new Dictionary <string, object>();
            var uploadResult         = fileHandler.FileUpload <UploadFileResponse>($"{CSVFiles.Data[$"{resource}"]}", System.Net.Http.HttpMethod.Post);

            requestMappingUpdate = mode == Mode.Import ? RequestValidExchangeMappingUpdate(ImportMappingIds.Data[$"{resource}"], label, scope, ImportContents[$"{resource}"]):
                                   RequestValidExchangeMappingUpdate(ExportMappingIds.Data[$"{resource}"], label, scope, ExportContents[$"{resource}"]);

            var mappingResult = mappingHandler.ExchangeMapping <object>(requestMappingUpdate, System.Net.Http.HttpMethod.Put);

            PrAssert.That(mappingResult, PrIs.SuccessfulResponse().And.HttpCode((int)System.Net.HttpStatusCode.NoContent));

            var queueRequest     = CreateQueueRequest(mode, resource, uploadResult.Result.FileId);
            var queueResult      = exchangeQueueHandler.Queue <int>(queueRequest, System.Net.Http.HttpMethod.Post);
            var hrbcQueueRequest = CreateHrbcQueueRequest(mode, queueResult.Result);

            var result = GetRequestQueueMapping(hrbcQueueRequest);

            PrAssert.That(result, PrIs.SuccessfulResponse().And.HttpCode((int)System.Net.HttpStatusCode.OK));
            PrAssert.That(result.Result.Status, PrIs.EqualTo("finished"));
            PrAssert.That(result.Result.Log.Failed, PrIs.Zero);
        }