public async void CanGetCurrencyListFromChangelly()
        {
            using (var tester = ServerTester.Create())
            {
                tester.Start();
                var user = tester.NewAccount();
                user.GrantAccess();

                //save changelly settings
                var updateModel      = CreateDefaultChangellyParams(true);
                var storesController = tester.PayTester.GetController <StoresController>(user.UserId, user.StoreId);

                //confirm saved
                Assert.Equal("UpdateStore", Assert.IsType <RedirectToActionResult>(
                                 await storesController.UpdateChangellySettings(user.StoreId, updateModel, "save")).ActionName);

                var factory             = UnitTest1.CreateBTCPayRateFactory();
                var fetcher             = new RateFetcher(factory);
                var httpClientFactory   = new MockHttpClientFactory();
                var changellyController = new ChangellyController(
                    new ChangellyClientProvider(tester.PayTester.StoreRepository, httpClientFactory),
                    tester.NetworkProvider, fetcher);
                changellyController.IsTest = true;
                var result = Assert
                             .IsType <OkObjectResult>(await changellyController.GetCurrencyList(user.StoreId))
                             .Value as IEnumerable <CurrencyFull>;
                Assert.True(result.Any());
            }
        }
        public async void CanCalculateToAmountForChangelly()
        {
            using (var tester = ServerTester.Create())
            {
                tester.Start();
                var user = tester.NewAccount();
                user.GrantAccess();

                var updateModel      = CreateDefaultChangellyParams(true);
                var storesController = tester.PayTester.GetController <StoresController>(user.UserId, user.StoreId);

                Assert.Equal("UpdateStore", Assert.IsType <RedirectToActionResult>(
                                 await storesController.UpdateChangellySettings(user.StoreId, updateModel, "save")).ActionName);

                var factory             = UnitTest1.CreateBTCPayRateFactory();
                var fetcher             = new RateFetcher(factory);
                var httpClientFactory   = new MockHttpClientFactory();
                var changellyController = new ChangellyController(
                    new ChangellyClientProvider(tester.PayTester.StoreRepository, httpClientFactory),
                    tester.NetworkProvider, fetcher);
                changellyController.IsTest = true;
                Assert.IsType <decimal>(Assert
                                        .IsType <OkObjectResult>(await changellyController.CalculateAmount(user.StoreId, "ltc", "btc", 1.0m))
                                        .Value);
            }
        }
        public async Task CanUseAzureBlobStorage()
        {
            using var tester = CreateServerTester();
            await tester.StartAsync();

            var user = tester.NewAccount();

            user.GrantAccess();
            var controller = tester.PayTester.GetController <UIServerController>(user.UserId, user.StoreId);
            var azureBlobStorageConfiguration = Assert.IsType <AzureBlobStorageConfiguration>(Assert
                                                                                              .IsType <ViewResult>(await controller.StorageProvider(StorageProvider.AzureBlobStorage.ToString()))
                                                                                              .Model);

            azureBlobStorageConfiguration.ConnectionString = FactWithSecretAttribute.GetFromSecrets("AzureBlobStorageConnectionString");
            azureBlobStorageConfiguration.ContainerName    = "testscontainer";
            Assert.IsType <ViewResult>(
                await controller.EditAzureBlobStorageStorageProvider(azureBlobStorageConfiguration));


            var shouldBeRedirectingToAzureStorageConfigPage =
                Assert.IsType <RedirectToActionResult>(await controller.Storage());

            Assert.Equal(nameof(StorageProvider), shouldBeRedirectingToAzureStorageConfigPage.ActionName);
            Assert.Equal(StorageProvider.AzureBlobStorage,
                         shouldBeRedirectingToAzureStorageConfigPage.RouteValues["provider"]);

            //seems like azure config worked, let's see if the conn string was actually saved

            Assert.Equal(azureBlobStorageConfiguration.ConnectionString, Assert
                         .IsType <AzureBlobStorageConfiguration>(Assert
                                                                 .IsType <ViewResult>(
                                                                     await controller.StorageProvider(StorageProvider.AzureBlobStorage.ToString()))
                                                                 .Model).ConnectionString);



            await UnitTest1.CanUploadRemoveFiles(controller);
        }