mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
fix test
This commit is contained in:
@@ -43,17 +43,19 @@ namespace BTCPayServer.Tests
|
|||||||
entity.TxFee = Money.Coins(0.1m);
|
entity.TxFee = Money.Coins(0.1m);
|
||||||
entity.Rate = 5000;
|
entity.Rate = 5000;
|
||||||
|
|
||||||
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.Payments = new System.Collections.Generic.List<PaymentEntity>();
|
||||||
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
||||||
|
|
||||||
|
// Some check that handling legacy stuff does not break things
|
||||||
|
var cryptoData = entity.GetCryptoData("BTC", null, true);
|
||||||
|
cryptoData.Calculate();
|
||||||
|
Assert.NotNull(cryptoData);
|
||||||
|
Assert.Null(entity.GetCryptoData("BTC", null, false));
|
||||||
|
entity.SetCryptoData(new CryptoData() { ParentEntity = entity, Rate = entity.Rate, CryptoCode = "BTC", TxFee = entity.TxFee });
|
||||||
|
Assert.NotNull(entity.GetCryptoData("BTC", null, false));
|
||||||
|
Assert.NotNull(entity.GetCryptoData("BTC", null, true));
|
||||||
|
////////////////////
|
||||||
|
|
||||||
var accounting = cryptoData.Calculate();
|
var accounting = cryptoData.Calculate();
|
||||||
Assert.Equal(Money.Coins(1.1m), accounting.Due);
|
Assert.Equal(Money.Coins(1.1m), accounting.Due);
|
||||||
Assert.Equal(Money.Coins(1.1m), accounting.TotalDue);
|
Assert.Equal(Money.Coins(1.1m), accounting.TotalDue);
|
||||||
|
|||||||
Reference in New Issue
Block a user