public void UserCanViewTopThreeExchangesTrustScore(List <Exchange> exchanges) { $"When the user queries the top three exchanges" .x(async() => { exchanges = (await ZigluService.GetExchanges(3)).ToList(); }); $"Then the user can see each of the exchanges names and their trust ranking" .x(() => { Assert.Equal(3, exchanges.Count); foreach (var exchange in exchanges) { exchange.TrustScore.Should().NotBe(default);
public void UserCanQueryCoinValueInGbp(string coinId) { Coin coin = null; $"When the user queries coin data for {coinId}" .x(async() => { coin = await ZigluService.CoinInfo(coinId); }); $"Then the user sees data for {coinId}" .x(() => { _output.WriteLine(Service.ModelToTextOutput(coin)); Assert.Equal(coinId, coin.Name, true); }); $"And the user sees the value of {coinId} in GBP" .x(() => { coin.MarketValue.Should().NotBe(default); });
[InlineData(5)] // test works for however many exchanges you want to see public void UserCanView24HourBitcoinTradingVolumes(int numberOfExchanges) { var tradingVolumesExchanges = new List <Exchange>(); // What's the given here? there isn't really one? // Givens are meant to describe initial system context // https://cucumber.io/docs/gherkin/reference/#given "When the user queries trading volumes" .x(async() => { tradingVolumesExchanges = (await ZigluService .TopBitcoinTradingVolumesByExchange(numberOfExchanges)).ToList(); }); $"Then the user sees the top {numberOfExchanges} exchanges with the highest 24 hour trading bitcoin volumes" .x(() => { Assert.Equal(numberOfExchanges, tradingVolumesExchanges.Count); _output .WriteLine( $"Top {numberOfExchanges} Exchanges with Highest 24 Hour Normalised BTC Trade Volumes:"); foreach (var output in tradingVolumesExchanges .Select(exchange => $"{exchange.Name}/{exchange.TradeVolume24HoursNormalized}")) { _output.WriteLine(output); } }); // we're effectively testing the service has ordered the results desc here // OK I guess as we're actually testing something in ziglus domain here $"And the results are in descending order" .x(() => { tradingVolumesExchanges.Should() .BeInDescendingOrder(x => x.TradeVolume24HoursNormalized); }); }