예제 #1
0
        public async Task CurrencyCodeList_should_return_currency_codes()
        {
            var result = await commonClient.CurrencyCodeList();

            List <string> containCurrency = new List <string> {
                "CHF", "TRY", "EUR"
            };

            Assert.NotNull(result);
            Assert.True(result.Where(q => containCurrency.Contains(q.Code)).ToList().Count() == containCurrency.Count());
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            var clientOpitons = new ClientOptions
            {
                AuthServiceUrl    = "https://coretest.isim360.com",
                InvoiceServiceUrl = "https://efaturaservicetest.isim360.com",
                Auth = new ClientOptions.AuthOption
                {
                    ClientId = "serviceApi",
                    Username = "******",
                    Password = "******"
                }
            };
            var client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            // tek servis ise memory kullanılabilir, aksi halde redis vb kullanılmalı
            var distributedCacheProvider = new MemoryDistributedCache(
                new OptionsWrapper <MemoryDistributedCacheOptions>(new MemoryDistributedCacheOptions()));
            var authClient = new AuthClient(clientOpitons, client, distributedCacheProvider);

            FlurlHttp.Configure(settings => settings.HttpClientFactory = new PollyHttpClientFactory(authClient));
            var clientFactory       = new PerBaseUrlFlurlClientFactory();
            var outboxInvoiceClient = new OutboxInvoiceClient(clientOpitons, clientFactory);
            var inboxInvoiceClient  = new InboxInvoiceClient(clientOpitons, clientFactory);
            var commonClient        = new CommonClient(clientOpitons, clientFactory);
            var earchiveClient      = new EArchiveInvoiceClient(clientOpitons, clientFactory);

            var currencies = await commonClient.CurrencyCodeList();

            currencies.ForEach(c => System.Console.WriteLine($"{c.Code} {c.Name}"));


            System.Console.ReadLine();
        }
 public async Task <ActionResult <List <CurrencyModel> > > CurrencyCodeList()
 {
     return(await commonClient.CurrencyCodeList());
 }