Exemplo n.º 1
0
        public async Task Should_store_prices_into_database()
        {
            // arrange
            _coinRepository.Setup(r => r.GetPricesAsync()).ReturnsAsync(new List <SnapshotPrice>
            {
                new SnapshotPrice(Coin.BTC, "100", Currency.EUR, "100", "100", "0.1", DateTime.UtcNow),
                new SnapshotPrice(Coin.ETH, "100", Currency.EUR, "100", "100", "0.1", DateTime.UtcNow),
                new SnapshotPrice(Coin.LTC, "100", Currency.EUR, "100", "100", "0.1", DateTime.UtcNow)
            });

            // act
            await _controller.Post();

            // assert
            _coinRepository.Verify(r => r.GetPricesAsync());
            _priceRepository.Verify(r => r.SaveAsync(Moq.It.IsAny <SnapshotPrice>()), Times.Exactly(3));
        }