public Mock <IBittrexClient> GetClient() { var moq = new Mock <IBittrexClient>(); moq.Setup( x => x.GetTickerAsync(TradingPair.Create("ETH", "BTC").ToString(_tradingPairFormatOption), It.IsAny <CancellationToken>())).ReturnsAsync( new TickerResult() { Success = true, Message = "", Result = new CryptoSharp.Client.Exchanges.Bittrex.Ticker() { Ask = 0.12345678m, Bid = 1.23456789m, Last = 2.34567891m, } }); moq.Setup( x => x.GetTickerAsync(It.IsAny <string>())) .ReturnsAsync(new TickerResult() { Success = false, Message = "INVALID_MARKET", Result = null }); return(moq); }
public void GetTicker_BTCETH_Test() { var expectedResult = ExpectedResult.ExpectedTicker(_sut.Name); var result = _sut.GetTickerAsync(TradingPair.Create("ETH", "BTC")).Result; Assert.IsTrue( JsonConvert.SerializeObject(expectedResult) == JsonConvert.SerializeObject(result)); }
public static Ticker ExpectedTicker(string exchangeName) { return(new Ticker(exchangeName, TradingPair.Create("ETH", "BTC"), 0.12345678m, 1.23456789m, 2.34567891m)); }