Fix unit test

This commit is contained in:
nicolas.dorier
2018-01-12 16:54:57 +09:00
parent d5ad0cdb39
commit a1ebedc0d1
2 changed files with 9 additions and 3 deletions

View File

@@ -43,8 +43,14 @@ namespace BTCPayServer.Tests
entity.TxFee = Money.Coins(0.1m);
entity.Rate = 5000;
var cryptoData = entity.GetCryptoData("BTC", null);
var cryptoData = entity.GetCryptoData("BTC", null, true);
Assert.NotNull(cryptoData); // Should use legacy data to build itself
Assert.Null(entity.GetCryptoData("BTC", null, false));
entity.SetCryptoData(new CryptoData() { ParentEntity = entity, Rate = entity.Rate, CryptoCode = "BTC", TxFee = entity.TxFee, FeeRate = new FeeRate(entity.TxFee, 100), DepositAddress = entity.DepositAddress, Network = null });
Assert.NotNull(entity.GetCryptoData("BTC", null, false));
Assert.NotNull(entity.GetCryptoData("BTC", null, true));
entity.Payments = new System.Collections.Generic.List<PaymentEntity>();
entity.ProductInformation = new ProductInformation() { Price = 5000 };

View File

@@ -395,9 +395,9 @@ namespace BTCPayServer.Services.Invoices
return rates.TryGetValue(network.CryptoCode, out var data);
}
public CryptoData GetCryptoData(string cryptoCode, BTCPayNetworkProvider networkProvider)
public CryptoData GetCryptoData(string cryptoCode, BTCPayNetworkProvider networkProvider, bool alwaysIncludeBTC = false)
{
GetCryptoData(networkProvider).TryGetValue(cryptoCode, out var data);
GetCryptoData(networkProvider, alwaysIncludeBTC).TryGetValue(cryptoCode, out var data);
return data;
}