public void CrossSwopTradeStorageTest() { var requestCase = new GetQuoteRequest() { FromAsset = "BTC", ToAsset = "ETH", FromAssetVolume = 0, ToAssetVolume = 1, IsFromFixed = false, BrokerId = "broker", AccountId = "Acc", WalletId = "wallet" }; var responseData = Service.GetQuoteAsync(requestCase).Result.Data; var storageTrade = ConvertQuoteStorageMock.GetTradesAsync(responseData.OperationId).Result; Assert.IsTrue(storageTrade.Count == 2); var firstPair = storageTrade.FirstOrDefault(trade => trade.InstrumentSymbol == "BTCUSD"); var secondPair = storageTrade.FirstOrDefault(trade => trade.InstrumentSymbol == "ETHUSD"); Assert.IsNotNull(firstPair); Assert.IsNotNull(secondPair); Assert.AreEqual(responseData.OperationId, firstPair.OperationId); Assert.AreEqual(52544.8585, firstPair.InstrumentPrice); Assert.AreEqual(TradeState.New, firstPair.State); Assert.IsNotEmpty(firstPair.TradeId); Assert.AreEqual(responseData.OperationId, secondPair.OperationId); Assert.AreEqual(5253, secondPair.InstrumentPrice); Assert.AreEqual(TradeState.New, secondPair.State); Assert.IsNotEmpty(secondPair.TradeId); }
public void CrossSwopQuoteStorageTest() { var requestCase = new GetQuoteRequest() { FromAsset = "BTC", ToAsset = "ETH", FromAssetVolume = 0, ToAssetVolume = 1, IsFromFixed = false, BrokerId = "broker", AccountId = "Acc", WalletId = "wallet" }; var responseData = Service.GetQuoteAsync(requestCase).Result.Data; var storageQuote = ConvertQuoteStorageMock.GetQuoteAsync(responseData.OperationId).Result; var storageTrade = ConvertQuoteStorageMock.GetTradesAsync(responseData.OperationId).Result; Assert.AreEqual(responseData.FromAsset, storageQuote.FromAsset); Assert.AreEqual(responseData.FromAsset, storageQuote.FromAsset); Assert.AreEqual(responseData.ToAsset, storageQuote.ToAsset); Assert.AreEqual(responseData.IsFromFixed, storageQuote.IsFromFixed); Assert.AreEqual(responseData.BrokerId, storageQuote.BrokerId); Assert.AreEqual(responseData.AccountId, storageQuote.AccountId); Assert.AreEqual(responseData.WalletId, storageQuote.WalletId); Assert.AreEqual(responseData.OperationId, storageQuote.OperationId); Assert.AreEqual(responseData.Price, storageQuote.Price); if (responseData.IsFromFixed) { Assert.AreEqual(requestCase.FromAssetVolume, storageQuote.FromAssetVolume); Assert.AreEqual(responseData.ToAssetVolume, storageQuote.ToAssetVolume); } else { Assert.AreEqual(requestCase.ToAssetVolume, storageQuote.ToAssetVolume); Assert.AreEqual(responseData.FromAssetVolume, storageQuote.FromAssetVolume); } }