コード例 #1
0
        public async Task DownloadReadMeFile(string batchId, string exchangeSetRootPath, string correlationId)
        {
            string readMeFilePath = await logger.LogStartEndAndElapsedTimeAsync(EventIds.QueryFileShareServiceReadMeFileRequestStart,
                                                                                EventIds.QueryFileShareServiceReadMeFileRequestCompleted,
                                                                                "File share service search query request for readme file for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}",
                                                                                async() =>
            {
                return(await fulfilmentFileShareService.SearchReadMeFilePath(batchId, correlationId));
            },
                                                                                batchId, correlationId);

            if (!string.IsNullOrWhiteSpace(readMeFilePath))
            {
                DateTime createReadMeFileTaskStartedAt = DateTime.UtcNow;
                await logger.LogStartEndAndElapsedTimeAsync(EventIds.DownloadReadMeFileRequestStart,
                                                            EventIds.DownloadReadMeFileRequestCompleted,
                                                            "File share service download request for readme file for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}",
                                                            async() =>
                {
                    return(await fulfilmentFileShareService.DownloadReadMeFile(readMeFilePath, batchId, exchangeSetRootPath, correlationId));
                },
                                                            batchId, correlationId);

                DateTime createReadMeFileTaskCompletedAt = DateTime.UtcNow;
                monitorHelper.MonitorRequest("Download ReadMe File Task", createReadMeFileTaskStartedAt, createReadMeFileTaskCompletedAt, correlationId, null, null, null, batchId);
            }
        }
コード例 #2
0
        public async Task WhenValidMessageQueueTrigger_ThenReturnsExchangeSetCreatedSuccessfully()
        {
            SalesCatalogueServiceResponseQueueMessage scsResponseQueueMessage       = GetScsResponseQueueMessage();
            SalesCatalogueProductResponse             salesCatalogueProductResponse = GetSalesCatalogueResponse();

            var fulfilmentDataResponse = new List <FulfilmentDataResponse>()
            {
                new FulfilmentDataResponse {
                    BatchId = "63d38bde-5191-4a59-82d5-aa22ca1cc6dc", EditionNumber = 10, ProductName = "Demo", UpdateNumber = 3, FileUri = new List <string> {
                        "http://ffs-demo.azurewebsites.net"
                    }
                }
            };

            string storageAccountConnectionString = "DefaultEndpointsProtocol = https; AccountName = testessdevstorage2; AccountKey =testaccountkey; EndpointSuffix = core.windows.net";

            fakeConfiguration["HOME"] = @"D:\\Downloads";
            fakeFileShareServiceConfig.Value.ExchangeSetFileFolder = "V01X01";
            fakeFileShareServiceConfig.Value.EncRoot = "ENC_ROOT";
            SalesCatalogueDataResponse salesCatalogueDataResponse = GetSalesCatalogueDataResponse();

            A.CallTo(() => fakeScsStorageService.GetStorageAccountConnectionString(null, null))
            .Returns(storageAccountConnectionString);
            string filePath = @"D:\\Downloads";

            A.CallTo(() => fakeAzureBlobStorageService.DownloadSalesCatalogueResponse(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(salesCatalogueProductResponse);
            A.CallTo(() => fakeQueryFssService.SearchReadMeFilePath(A <string> .Ignored, A <string> .Ignored)).Returns(filePath);
            A.CallTo(() => fakeQueryFssService.DownloadReadMeFile(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(true);
            A.CallTo(() => fakeQueryFssService.CreateZipFileForExchangeSet(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(true);
            A.CallTo(() => fakeQueryFssService.UploadZipFileForExchangeSetToFileShareService(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(true);
            A.CallTo(() => fakeFulfilmentAncillaryFiles.CreateCatalogFile(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored, fulfilmentDataResponse, salesCatalogueDataResponse, salesCatalogueProductResponse)).Returns(true);
            A.CallTo(() => fakeFulfilmentSalesCatalogueService.GetSalesCatalogueDataResponse(A <string> .Ignored, A <string> .Ignored)).Returns(salesCatalogueDataResponse);
            A.CallTo(() => fakeFulfilmentAncillaryFiles.CreateProductFile(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored, salesCatalogueDataResponse)).Returns(true);
            A.CallTo(() => fakeFulfilmentCallBackService.SendCallBackResponse(A <SalesCatalogueProductResponse> .Ignored, A <SalesCatalogueServiceResponseQueueMessage> .Ignored)).Returns(true);

            string salesCatalogueResponseFile = await fulfilmentDataService.CreateExchangeSet(scsResponseQueueMessage, currentUtcDate);

            Assert.AreEqual("Exchange Set Created Successfully", salesCatalogueResponseFile);
        }