public void GetCommission_EveryCondition_Success(double expected, double actual) { var Fr = new ExchangeProvider(); var result = Fr.GetCommission(actual); expected.Should().Be(result); }
public void Exchange_EveryCondition_Success(double expected, double actual) { var Exch = new ExchangeProvider(); var result = Math.Round(Exch.Exchange(actual), 2); expected.Should().Be(result); }
public BotController(ILogger <BotController> logger, IBackgroundTaskQueue taskQueue, SlackAuthorizationActionFilter slackVerificationProvider, ExchangeProvider exchangeProvider, BotProcessingService service) { _logger = logger; _slackVerificationProvider = slackVerificationProvider; _exchangeProvider = exchangeProvider; _taskQueue = taskQueue; service.StartAsync(new CancellationToken()); }
public void TestMethod1() { var s = SlackResponseFactory.CreateWhereIsResponse("Robson", "Vancouver Office", new Uri("https://slack-whereis.s3.ca-central-1.amazonaws.com/maps/saturna.png"), "Meeting Room", UseStatus.Available, "Available until 5:00 PM", floor: "16th Floor"); var j = JsonConvert.SerializeObject(s); ExchangeProvider p = new ExchangeProvider(new ExchangeConfig() { Server = "https://exchange.absolute.com/ews/exchange.asmx", Domain = "absolute.com", Username = "******", Password = "******" }); bool isAvailable = p.GetAvailability("*****@*****.**", out string details); }
public IExchangeProvider GetExchangeProvider(ExchangeProvider name) { switch (name) { case ExchangeProvider.GDAX: var protoсol = SettingsManager.Get(name, "Protocol"); return(CreateInstance(ExchangeProvider.GDAX, (ExchangeProtocol)Enum.Parse(typeof(ExchangeProtocol), protoсol))); default: throw new Exception("Unknown provider type"); } }
private IExchangeProvider CreateInstance(ExchangeProvider provider, ExchangeProtocol protokol) { try { var className = $"FIXProtocolAdapter.Providers.{ExchangeProvider.GDAX.ToString()}" + $".{protokol.ToString()}ExchangeProvider"; // ReSharper disable once AssignNullToNotNullAttribute return((IExchangeProvider)Activator.CreateInstance(null, className).Unwrap()); } catch (Exception e) { throw; } }
static void Main(string[] args) { Console.Write("Введите сумму в рублях: "); var rubStrValue = Console.ReadLine(); var rubValue = 0.0; if (!double.TryParse(rubStrValue, out rubValue)) { throw new InvalidCastException($"Указанная сумма '{rubStrValue}' не является валидным числом"); } var provider = new ExchangeProvider(); var result = provider.Exchange(rubValue); Console.WriteLine($"Сумма в руб: {rubValue:# ##0.00}| курс: {provider.Cource:# ##0.00}| комиссия: {provider.GetCommission(rubValue):# ##0.00}| cумма в у.е.: {result:# ##0.00}"); }
public static string Get(ExchangeProvider provider, string key) { if (_settings == null) { ReadConfigFromJSON(); } try { if (_settings == null) { return(null); } var settings = _settings[provider]; var value = settings.GetType().GetProperty(key)?.GetValue(settings, null); return(value?.ToString()); } catch (Exception e) { throw; } }
public void Setup() { _worldConfiguration = new WorldConfiguration { MaxItemAmount = 999, BackpackSize = 48, MaxGoldAmount = 1000000000, MaxBankGoldAmount = 100000000000 }; var items = new List <ItemDto> { new Item { Type = PocketType.Main, VNum = 1012 }, new Item { Type = PocketType.Main, VNum = 1013 }, }; _itemProvider = new ItemProvider(items, new List <IHandler <Item, Tuple <IItemInstance, UseItemPacket> > >()); _exchangeProvider = new ExchangeProvider(_itemProvider, _worldConfiguration, _logger); }