Ejemplo n.º 1
0
        public async Task WhenCallStoreSaleCatalogueServiceResponseAsync_ThenReturnsTrue()
        {
            string batchId       = "7b4cdf10-adfa-4ed6-b2fe-d1543d8b7272";
            string containerName = "testContainer";
            string callBackUri   = "https://essTest/myCallback?secret=test&po=1234";
            string correlationId = "a6670458-9bbc-4b52-95a2-d1f50fe9e3ae";
            string storageAccountConnectionString = "DefaultEndpointsProtocol = https; AccountName = testessdevstorage2; AccountKey =testaccountkey; EndpointSuffix = core.windows.net";
            SalesCatalogueProductResponse salesCatalogueProductResponse = GetSalesCatalogueServiceResponse();
            CancellationToken             cancellationToken             = CancellationToken.None;

            A.CallTo(() => fakeScsStorageService.GetStorageAccountConnectionString(null, null)).Returns(storageAccountConnectionString);

            A.CallTo(() => fakeAzureBlobStorageClient.GetCloudBlockBlob(A <string> .Ignored, A <string> .Ignored, A <string> .Ignored)).Returns(new CloudBlockBlob(new System.Uri("http://tempuri.org/blob")));

            A.CallTo(() => fakeSmallExchangeSetInstance.GetInstanceNumber(1)).Returns(3);
            var response = await azureBlobStorageService.StoreSaleCatalogueServiceResponseAsync(containerName, batchId, salesCatalogueProductResponse, callBackUri, correlationId, cancellationToken, fakeExpiryDate);

            Assert.IsTrue(response);
        }
Ejemplo n.º 2
0
        public void WhenSmallExchangeSetInstance_ThenReturnsNotNullInResponse()
        {
            int smallMaxInstanceCount = 4;
            int response = 0;

            for (int i = 0; i < (smallMaxInstanceCount + 1); i++)
            {
                response = smallExchangeSetInstance.GetInstanceNumber(smallMaxInstanceCount);
                Assert.IsInstanceOf(typeof(int), response);
                Assert.AreEqual(smallExchangeSetInstance.GetCurrentInstanceNumber(), response);
                if (smallExchangeSetInstance.GetCurrentInstanceNumber() != smallMaxInstanceCount)
                {
                    Assert.AreNotEqual(smallMaxInstanceCount, response);
                }
                else
                {
                    Assert.AreEqual(smallMaxInstanceCount, response);
                }
            }
            Assert.AreEqual(1, response);
        }
Ejemplo n.º 3
0
 private (int, ExchangeSetType) GetInstanceCountBasedOnFileSize(double fileSizeInMB)
 {
     if (fileSizeInMB <= storageConfig.Value.SmallExchangeSetSizeInMB)
     {
         return(smallExchangeSetInstance.GetInstanceNumber(storageConfig.Value.SmallExchangeSetInstance), ExchangeSetType.sxs);
     }
     else if (fileSizeInMB > storageConfig.Value.SmallExchangeSetSizeInMB && fileSizeInMB <= storageConfig.Value.LargeExchangeSetSizeInMB)
     {
         return(mediumExchangeSetInstance.GetInstanceNumber(storageConfig.Value.MediumExchangeSetInstance), ExchangeSetType.mxs);
     }
     else
     {
         return(largeExchangeSetInstance.GetInstanceNumber(storageConfig.Value.LargeExchangeSetInstance), ExchangeSetType.lxs);
     }
 }