mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
UnitTest1.cs code reformatting
This commit is contained in:
parent
4db67e5bc5
commit
4dd0ae8bdc
1 changed files with 16 additions and 16 deletions
|
@ -773,28 +773,28 @@ namespace BTCPayServer.Tests
|
||||||
await Task.Delay(100); // wait a bit for payment to process before fetching new invoice
|
await Task.Delay(100); // wait a bit for payment to process before fetching new invoice
|
||||||
var newInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id);
|
var newInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id);
|
||||||
var newBolt11 = newInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
var newBolt11 = newInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||||
var oldBolt11= invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
var oldBolt11 = invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||||
Assert.NotEqual(newBolt11,oldBolt11);
|
Assert.NotEqual(newBolt11, oldBolt11);
|
||||||
Assert.Equal(newInvoice.BtcDue.GetValue(), BOLT11PaymentRequest.Parse(newBolt11, Network.RegTest).MinimumAmount.ToDecimal(LightMoneyUnit.BTC));
|
Assert.Equal(newInvoice.BtcDue.GetValue(), BOLT11PaymentRequest.Parse(newBolt11, Network.RegTest).MinimumAmount.ToDecimal(LightMoneyUnit.BTC));
|
||||||
|
|
||||||
Logs.Tester.LogInformation($"Paying invoice {newInvoice.Id} remaining due amount {newInvoice.BtcDue.GetValue()} via lightning" );
|
Logs.Tester.LogInformation($"Paying invoice {newInvoice.Id} remaining due amount {newInvoice.BtcDue.GetValue()} via lightning");
|
||||||
var evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
var evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
||||||
{
|
{
|
||||||
await tester.SendLightningPaymentAsync(newInvoice);
|
await tester.SendLightningPaymentAsync(newInvoice);
|
||||||
}, evt => evt.InvoiceId == invoice.Id);
|
}, evt => evt.InvoiceId == invoice.Id);
|
||||||
|
|
||||||
var fetchedInvoice = await tester.PayTester.InvoiceRepository.GetInvoice(evt.InvoiceId);
|
var fetchedInvoice = await tester.PayTester.InvoiceRepository.GetInvoice(evt.InvoiceId);
|
||||||
Assert.Contains(fetchedInvoice.Status, new []{InvoiceStatus.Complete, InvoiceStatus.Confirmed});
|
Assert.Contains(fetchedInvoice.Status, new[] { InvoiceStatus.Complete, InvoiceStatus.Confirmed });
|
||||||
Assert.Equal(InvoiceExceptionStatus.None, fetchedInvoice.ExceptionStatus);
|
Assert.Equal(InvoiceExceptionStatus.None, fetchedInvoice.ExceptionStatus);
|
||||||
|
|
||||||
Logs.Tester.LogInformation($"Paying invoice {invoice.Id} original full amount bolt11 invoice " );
|
Logs.Tester.LogInformation($"Paying invoice {invoice.Id} original full amount bolt11 invoice ");
|
||||||
evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
||||||
{
|
{
|
||||||
await tester.SendLightningPaymentAsync(invoice);
|
await tester.SendLightningPaymentAsync(invoice);
|
||||||
}, evt => evt.InvoiceId == invoice.Id);
|
}, evt => evt.InvoiceId == invoice.Id);
|
||||||
Assert.Equal(evt.InvoiceId, invoice.Id);
|
Assert.Equal(evt.InvoiceId, invoice.Id);
|
||||||
fetchedInvoice = await tester.PayTester.InvoiceRepository.GetInvoice(evt.InvoiceId);
|
fetchedInvoice = await tester.PayTester.InvoiceRepository.GetInvoice(evt.InvoiceId);
|
||||||
Assert.Equal( 3,fetchedInvoice.Payments.Count);
|
Assert.Equal(3, fetchedInvoice.Payments.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact(Timeout = 60 * 2 * 1000)]
|
[Fact(Timeout = 60 * 2 * 1000)]
|
||||||
|
@ -1991,7 +1991,7 @@ namespace BTCPayServer.Tests
|
||||||
};
|
};
|
||||||
var criteriaCompat = store.GetPaymentMethodCriteria(tester.NetworkProvider, blob);
|
var criteriaCompat = store.GetPaymentMethodCriteria(tester.NetworkProvider, blob);
|
||||||
Assert.Single(criteriaCompat);
|
Assert.Single(criteriaCompat);
|
||||||
Assert.NotNull(criteriaCompat.FirstOrDefault(methodCriteria => methodCriteria.Value.ToString() == "2 USD" && methodCriteria.Above && methodCriteria.PaymentMethod == new PaymentMethodId("BTC", BitcoinPaymentType.Instance) ));
|
Assert.NotNull(criteriaCompat.FirstOrDefault(methodCriteria => methodCriteria.Value.ToString() == "2 USD" && methodCriteria.Above && methodCriteria.PaymentMethod == new PaymentMethodId("BTC", BitcoinPaymentType.Instance)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2045,7 +2045,7 @@ namespace BTCPayServer.Tests
|
||||||
};
|
};
|
||||||
var criteriaCompat = store.GetPaymentMethodCriteria(tester.NetworkProvider, blob);
|
var criteriaCompat = store.GetPaymentMethodCriteria(tester.NetworkProvider, blob);
|
||||||
Assert.Single(criteriaCompat);
|
Assert.Single(criteriaCompat);
|
||||||
Assert.NotNull(criteriaCompat.FirstOrDefault(methodCriteria => methodCriteria.Value.ToString() == "2 USD" && !methodCriteria.Above && methodCriteria.PaymentMethod == new PaymentMethodId("BTC", LightningPaymentType.Instance) ));
|
Assert.NotNull(criteriaCompat.FirstOrDefault(methodCriteria => methodCriteria.Value.ToString() == "2 USD" && !methodCriteria.Above && methodCriteria.PaymentMethod == new PaymentMethodId("BTC", LightningPaymentType.Instance)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue