Пример #1
0
        public async Task StorageAccountServiceTest_GetReturnsCorrectAccount()
        {
            var appSettings = new AppSettings();

            appSettings.TokenUrl = "http://good.uri";
            var config             = Options.Create(appSettings);
            var resources          = new Resources();
            var mockAzureClient    = Substitute.For <IAzureClient>();
            var storageAccountList = new StorageAccountList();

            storageAccountList.accountList = new List <StorageAccount>()
            {
                new StorageAccount()
                {
                    Kind = "testkind"
                }
            };
            mockAzureClient.AzureGet(Arg.Any <string>(), Arg.Any <string>())
            .Returns(Task.FromResult(JsonConvert.SerializeObject(storageAccountList)));
            var storageAccountService = new StorageAccountService(config, mockAzureClient, resources);
            var accounts = await storageAccountService.GetStorageAccounts();

            accounts.accountList[0].Kind.Equals("testkind");
        }
Пример #2
0
 public StorageAccountController(ILogger <HomeController> logger, DatabaseContext context, StorageAccountService storageAccountService)
 {
     this.context = context;
     _logger      = logger;
     this.storageAccountService = storageAccountService;
 }