Esempio n. 1
0
        public async Task <bool> CreateCatalogFile(string batchId, string exchangeSetRootPath, string correlationId, List <FulfilmentDataResponse> listFulfilmentData, SalesCatalogueDataResponse salesCatalogueDataResponse, SalesCatalogueProductResponse salesCatalogueProductResponse)
        {
            bool isFileCreated = false;

            if (!string.IsNullOrWhiteSpace(exchangeSetRootPath))
            {
                DateTime createCatalogFileTaskStartedAt = DateTime.UtcNow;
                isFileCreated = await logger.LogStartEndAndElapsedTimeAsync(EventIds.CreateCatalogFileRequestStart,
                                                                            EventIds.CreateCatalogFileRequestCompleted,
                                                                            "Create catalog file request for BatchId:{BatchId} and _X-Correlation-ID:{CorrelationId}",
                                                                            async() => {
                    return(await fulfilmentAncillaryFiles.CreateCatalogFile(batchId, exchangeSetRootPath, correlationId, listFulfilmentData, salesCatalogueDataResponse, salesCatalogueProductResponse));
                },
                                                                            batchId, correlationId);

                DateTime createCatalogFileTaskCompletedAt = DateTime.UtcNow;
                monitorHelper.MonitorRequest("Create Catalog File Task", createCatalogFileTaskStartedAt, createCatalogFileTaskCompletedAt, correlationId, null, null, null, batchId);
            }

            return(isFileCreated);
        }
Esempio n. 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);
        }