From 6397c8e07cede39d94056da12c93be6f1cafa4a6 Mon Sep 17 00:00:00 2001 From: rockstardev <5191402+rockstardev@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:53:29 -0600 Subject: [PATCH] Resolving xunit warnings after update --- .../AltcoinTests/AltcoinTests.cs | 245 +++++++++--------- BTCPayServer.Tests/FastTests.cs | 22 +- BTCPayServer.Tests/GreenfieldAPITests.cs | 26 +- BTCPayServer.Tests/ThirdPartyTests.cs | 2 +- BTCPayServer.Tests/UnitTest1.cs | 12 +- 5 files changed, 153 insertions(+), 154 deletions(-) diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 0938bcc0e..37a5d7057 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -440,136 +440,135 @@ namespace BTCPayServer.Tests [Trait("Altcoins", "Altcoins")] public async Task CanPayWithTwoCurrencies() { - using (var tester = CreateServerTester()) + using var tester = CreateServerTester(); + + tester.ActivateLTC(); + await tester.StartAsync(); + var user = tester.NewAccount(); + await user.GrantAccessAsync(); + user.RegisterDerivationScheme("BTC"); + // First we try payment with a merchant having only BTC + var invoice = await user.BitPay.CreateInvoiceAsync( + new Invoice + { + Price = 5000.0m, + Currency = "USD", + PosData = "posData", + OrderId = "orderId", + ItemDesc = "Some description", + FullNotifications = true + }, Facade.Merchant); + + var cashCow = tester.ExplorerNode; + await cashCow.GenerateAsync(2); // get some money in case + var invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network); + var firstPayment = Money.Coins(0.04m); + await cashCow.SendToAddressAsync(invoiceAddress, firstPayment); + TestUtils.Eventually(() => { - tester.ActivateLTC(); - await tester.StartAsync(); - var user = tester.NewAccount(); - await user.GrantAccessAsync(); - user.RegisterDerivationScheme("BTC"); - // First we try payment with a merchant having only BTC - var invoice = await user.BitPay.CreateInvoiceAsync( - new Invoice - { - Price = 5000.0m, - Currency = "USD", - PosData = "posData", - OrderId = "orderId", - ItemDesc = "Some description", - FullNotifications = true - }, Facade.Merchant); + invoice = user.BitPay.GetInvoice(invoice.Id); + Assert.True(invoice.BtcPaid == firstPayment); + }); - var cashCow = tester.ExplorerNode; - await cashCow.GenerateAsync(2); // get some money in case - var invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network); - var firstPayment = Money.Coins(0.04m); - await cashCow.SendToAddressAsync(invoiceAddress, firstPayment); - TestUtils.Eventually(() => - { - invoice = user.BitPay.GetInvoice(invoice.Id); - Assert.True(invoice.BtcPaid == firstPayment); - }); + Assert.Single(invoice.CryptoInfo); // Only BTC should be presented - Assert.Single(invoice.CryptoInfo); // Only BTC should be presented - - var controller = tester.PayTester.GetController(null); - var checkout = - (Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, null) - .GetAwaiter().GetResult()).Value; - Assert.Single(checkout.AvailablePaymentMethods); - Assert.Equal("BTC", checkout.PaymentMethodCurrency); - - Assert.Single(invoice.PaymentCodes); - Assert.Single(invoice.SupportedTransactionCurrencies); - Assert.Single(invoice.SupportedTransactionCurrencies); - Assert.Single(invoice.PaymentSubtotals); - Assert.Single(invoice.PaymentTotals); - Assert.True(invoice.PaymentCodes.ContainsKey("BTC")); - Assert.True(invoice.SupportedTransactionCurrencies.ContainsKey("BTC")); - Assert.True(invoice.SupportedTransactionCurrencies["BTC"].Enabled); - Assert.True(invoice.PaymentSubtotals.ContainsKey("BTC")); - Assert.True(invoice.PaymentTotals.ContainsKey("BTC")); - ////////////////////// - - // Retry now with LTC enabled - user.RegisterDerivationScheme("LTC"); - invoice = await user.BitPay.CreateInvoiceAsync( - new Invoice - { - Price = 5000.0m, - Currency = "USD", - PosData = "posData", - OrderId = "orderId", - ItemDesc = "Some description", - FullNotifications = true - }, Facade.Merchant); - - cashCow = tester.ExplorerNode; - invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network); - firstPayment = Money.Coins(0.04m); - await cashCow.SendToAddressAsync(invoiceAddress, firstPayment); - TestLogs.LogInformation("First payment sent to " + invoiceAddress); - TestUtils.Eventually(() => - { - invoice = user.BitPay.GetInvoice(invoice.Id); - Assert.True(invoice.BtcPaid == firstPayment); - }); - - cashCow = tester.LTCExplorerNode; - var ltcCryptoInfo = invoice.CryptoInfo.FirstOrDefault(c => c.CryptoCode == "LTC"); - Assert.NotNull(ltcCryptoInfo); - invoiceAddress = BitcoinAddress.Create(ltcCryptoInfo.Address, cashCow.Network); - var secondPayment = Money.Coins(decimal.Parse(ltcCryptoInfo.Due, CultureInfo.InvariantCulture)); - await cashCow.GenerateAsync(4); // LTC is not worth a lot, so just to make sure we have money... - await cashCow.SendToAddressAsync(invoiceAddress, secondPayment); - TestLogs.LogInformation("Second payment sent to " + invoiceAddress); - TestUtils.Eventually(() => - { - invoice = user.BitPay.GetInvoice(invoice.Id); - Assert.Equal(Money.Zero, invoice.BtcDue); - var ltcPaid = invoice.CryptoInfo.First(c => c.CryptoCode == "LTC"); - Assert.Equal(Money.Zero, ltcPaid.Due); - Assert.Equal(secondPayment, ltcPaid.CryptoPaid); - Assert.Equal("paid", invoice.Status); - Assert.False((bool)((JValue)invoice.ExceptionStatus).Value); - }); - - controller = tester.PayTester.GetController(null); - checkout = (Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, "LTC") + var controller = tester.PayTester.GetController(null); + var checkout = + (Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, null) .GetAwaiter().GetResult()).Value; - Assert.Equal(2, checkout.AvailablePaymentMethods.Count); - Assert.Equal("LTC", checkout.PaymentMethodCurrency); + Assert.Single(checkout.AvailablePaymentMethods); + Assert.Equal("BTC", checkout.PaymentMethodCurrency); - Assert.Equal(2, invoice.PaymentCodes.Count()); - Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count()); - Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count()); - Assert.Equal(2, invoice.PaymentSubtotals.Count()); - Assert.Equal(2, invoice.PaymentTotals.Count()); - Assert.True(invoice.PaymentCodes.ContainsKey("LTC")); - Assert.True(invoice.SupportedTransactionCurrencies.ContainsKey("LTC")); - Assert.True(invoice.SupportedTransactionCurrencies["LTC"].Enabled); - Assert.True(invoice.PaymentSubtotals.ContainsKey("LTC")); - Assert.True(invoice.PaymentTotals.ContainsKey("LTC")); + Assert.Single(invoice.PaymentCodes); + Assert.Single(invoice.SupportedTransactionCurrencies); + Assert.Single(invoice.SupportedTransactionCurrencies); + Assert.Single(invoice.PaymentSubtotals); + Assert.Single(invoice.PaymentTotals); + Assert.True(invoice.PaymentCodes.ContainsKey("BTC")); + Assert.True(invoice.SupportedTransactionCurrencies.ContainsKey("BTC")); + Assert.True(invoice.SupportedTransactionCurrencies["BTC"].Enabled); + Assert.True(invoice.PaymentSubtotals.ContainsKey("BTC")); + Assert.True(invoice.PaymentTotals.ContainsKey("BTC")); + ////////////////////// - // Check if we can disable LTC - invoice = await user.BitPay.CreateInvoiceAsync( - new Invoice + // Retry now with LTC enabled + user.RegisterDerivationScheme("LTC"); + invoice = await user.BitPay.CreateInvoiceAsync( + new Invoice + { + Price = 5000.0m, + Currency = "USD", + PosData = "posData", + OrderId = "orderId", + ItemDesc = "Some description", + FullNotifications = true + }, Facade.Merchant); + + cashCow = tester.ExplorerNode; + invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network); + firstPayment = Money.Coins(0.04m); + await cashCow.SendToAddressAsync(invoiceAddress, firstPayment); + TestLogs.LogInformation("First payment sent to " + invoiceAddress); + TestUtils.Eventually(() => + { + invoice = user.BitPay.GetInvoice(invoice.Id); + Assert.True(invoice.BtcPaid == firstPayment); + }); + + cashCow = tester.LTCExplorerNode; + var ltcCryptoInfo = invoice.CryptoInfo.FirstOrDefault(c => c.CryptoCode == "LTC"); + Assert.NotNull(ltcCryptoInfo); + invoiceAddress = BitcoinAddress.Create(ltcCryptoInfo.Address, cashCow.Network); + var secondPayment = Money.Coins(decimal.Parse(ltcCryptoInfo.Due, CultureInfo.InvariantCulture)); + await cashCow.GenerateAsync(4); // LTC is not worth a lot, so just to make sure we have money... + await cashCow.SendToAddressAsync(invoiceAddress, secondPayment); + TestLogs.LogInformation("Second payment sent to " + invoiceAddress); + TestUtils.Eventually(() => + { + invoice = user.BitPay.GetInvoice(invoice.Id); + Assert.Equal(Money.Zero, invoice.BtcDue); + var ltcPaid = invoice.CryptoInfo.First(c => c.CryptoCode == "LTC"); + Assert.Equal(Money.Zero, ltcPaid.Due); + Assert.Equal(secondPayment, ltcPaid.CryptoPaid); + Assert.Equal("paid", invoice.Status); + Assert.False((bool)((JValue)invoice.ExceptionStatus).Value); + }); + + controller = tester.PayTester.GetController(null); + checkout = (Models.InvoicingModels.CheckoutModel)((JsonResult)controller.GetStatus(invoice.Id, "LTC") + .GetAwaiter().GetResult()).Value; + Assert.Equal(2, checkout.AvailablePaymentMethods.Count); + Assert.Equal("LTC", checkout.PaymentMethodCurrency); + + Assert.Equal(2, invoice.PaymentCodes.Count()); + Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count()); + Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count()); + Assert.Equal(2, invoice.PaymentSubtotals.Count()); + Assert.Equal(2, invoice.PaymentTotals.Count()); + Assert.True(invoice.PaymentCodes.ContainsKey("LTC")); + Assert.True(invoice.SupportedTransactionCurrencies.ContainsKey("LTC")); + Assert.True(invoice.SupportedTransactionCurrencies["LTC"].Enabled); + Assert.True(invoice.PaymentSubtotals.ContainsKey("LTC")); + Assert.True(invoice.PaymentTotals.ContainsKey("LTC")); + + // Check if we can disable LTC + invoice = await user.BitPay.CreateInvoiceAsync( + new Invoice + { + Price = 5000.0m, + Currency = "USD", + PosData = "posData", + OrderId = "orderId", + ItemDesc = "Some description", + FullNotifications = true, + SupportedTransactionCurrencies = new Dictionary() { - Price = 5000.0m, - Currency = "USD", - PosData = "posData", - OrderId = "orderId", - ItemDesc = "Some description", - FullNotifications = true, - SupportedTransactionCurrencies = new Dictionary() - { - {"BTC", new InvoiceSupportedTransactionCurrency() {Enabled = true}} - } - }, Facade.Merchant); + {"BTC", new InvoiceSupportedTransactionCurrency() {Enabled = true}} + } + }, Facade.Merchant); - Assert.Single(invoice.CryptoInfo.Where(c => c.CryptoCode == "BTC")); - Assert.Empty(invoice.CryptoInfo.Where(c => c.CryptoCode == "LTC")); - } + Assert.Single(invoice.CryptoInfo, c => c.CryptoCode == "BTC"); + Assert.DoesNotContain(invoice.CryptoInfo, c => c.CryptoCode == "LTC"); } [Fact] @@ -744,7 +743,7 @@ noninventoryitem: invoices = user.BitPay.GetInvoices(); Assert.Equal(2, invoices.Count(invoice => invoice.ItemCode.Equals("noninventoryitem"))); var inventoryItemInvoice = - Assert.Single(invoices.Where(invoice => invoice.ItemCode.Equals("inventoryitem"))); + Assert.Single(invoices, invoice => invoice.ItemCode.Equals("inventoryitem")); Assert.NotNull(inventoryItemInvoice); //let's mark the inventoryitem invoice as invalid, this should return the item to back in stock diff --git a/BTCPayServer.Tests/FastTests.cs b/BTCPayServer.Tests/FastTests.cs index 36505cf63..09dcf1baf 100644 --- a/BTCPayServer.Tests/FastTests.cs +++ b/BTCPayServer.Tests/FastTests.cs @@ -174,10 +174,10 @@ namespace BTCPayServer.Tests public void CanRandomizeByPercentage() { var generated = Enumerable.Range(0, 1000).Select(_ => MempoolSpaceFeeProvider.RandomizeByPercentage(100.0m, 10.0m)).ToArray(); - Assert.Empty(generated.Where(g => g < 90m)); - Assert.Empty(generated.Where(g => g > 110m)); - Assert.NotEmpty(generated.Where(g => g < 91m)); - Assert.NotEmpty(generated.Where(g => g > 109m)); + Assert.DoesNotContain(generated, g => g < 90m); + Assert.DoesNotContain(generated, g => g > 110m); + Assert.Contains(generated, g => g < 91m); + Assert.Contains(generated, g => g > 109m); } private void CanParseDecimalsCore(string str, decimal expected) @@ -793,9 +793,9 @@ namespace BTCPayServer.Tests }), BTCPayLogs); await tor.Refresh(); - Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.BTCPayServer)); - Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.P2P)); - Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.RPC)); + Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.BTCPayServer); + Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.P2P); + Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.RPC); Assert.True(tor.Services.Count(t => t.ServiceType == TorServiceType.Other) > 1); tor = new TorServices(CreateNetworkProvider(ChainName.Regtest), @@ -806,24 +806,24 @@ namespace BTCPayServer.Tests }), BTCPayLogs); await Task.WhenAll(tor.StartAsync(CancellationToken.None)); - var btcpayS = Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.BTCPayServer)); + var btcpayS = Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.BTCPayServer); Assert.Null(btcpayS.Network); Assert.Equal("host.onion", btcpayS.OnionHost); Assert.Equal(80, btcpayS.VirtualPort); - var p2p = Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.P2P)); + var p2p = Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.P2P); Assert.NotNull(p2p.Network); Assert.Equal("BTC", p2p.Network.CryptoCode); Assert.Equal("host2.onion", p2p.OnionHost); Assert.Equal(81, p2p.VirtualPort); - var rpc = Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.RPC)); + var rpc = Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.RPC); Assert.NotNull(p2p.Network); Assert.Equal("BTC", rpc.Network.CryptoCode); Assert.Equal("host3.onion", rpc.OnionHost); Assert.Equal(82, rpc.VirtualPort); - var unknown = Assert.Single(tor.Services.Where(t => t.ServiceType == TorServiceType.Other)); + var unknown = Assert.Single(tor.Services, t => t.ServiceType == TorServiceType.Other); Assert.Null(unknown.Network); Assert.Equal("host4.onion", unknown.OnionHost); Assert.Equal(83, unknown.VirtualPort); diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index bfebb99b7..1c5cebdfd 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -3867,7 +3867,7 @@ namespace BTCPayServer.Tests void VerifyLightning(GenericPaymentMethodData[] methods) { - var m = Assert.Single(methods.Where(m => m.PaymentMethodId == "BTC-LN")); + var m = Assert.Single(methods, m => m.PaymentMethodId == "BTC-LN"); Assert.Equal("Internal Node", m.Config["internalNodeRef"].Value()); } @@ -3879,7 +3879,7 @@ namespace BTCPayServer.Tests void VerifyOnChain(GenericPaymentMethodData[] dictionary) { - var m = Assert.Single(methods.Where(m => m.PaymentMethodId == "BTC-CHAIN")); + var m = Assert.Single(methods, m => m.PaymentMethodId == "BTC-CHAIN"); var paymentMethodBaseData = Assert.IsType(m.Config); Assert.Equal(wallet.Config.AccountDerivation, paymentMethodBaseData["accountDerivation"].Value()); } @@ -4412,8 +4412,8 @@ namespace BTCPayServer.Tests payouts = await adminClient.GetStorePayouts(admin.StoreId); Assert.Equal(3, payouts.Length); - Assert.Empty(payouts.Where(data => data.State == PayoutState.AwaitingApproval)); - Assert.Empty(payouts.Where(data => data.PayoutAmount is null)); + Assert.DoesNotContain(payouts, data => data.State == PayoutState.AwaitingApproval); + Assert.DoesNotContain(payouts, data => data.PayoutAmount is null); Assert.Empty(await adminClient.ShowOnChainWalletTransactions(admin.StoreId, "BTC")); @@ -4456,7 +4456,7 @@ namespace BTCPayServer.Tests { Assert.Equal(2, (await adminClient.ShowOnChainWalletTransactions(admin.StoreId, "BTC")).Count()); payouts = await adminClient.GetStorePayouts(admin.StoreId); - Assert.Single(payouts.Where(data => data.State == PayoutState.InProgress)); + Assert.Single(payouts, data => data.State == PayoutState.InProgress); }); uint256 txid = null; @@ -4470,7 +4470,7 @@ namespace BTCPayServer.Tests { Assert.Equal(4, (await adminClient.ShowOnChainWalletTransactions(admin.StoreId, "BTC")).Count()); payouts = await adminClient.GetStorePayouts(admin.StoreId); - Assert.Empty(payouts.Where(data => data.State != PayoutState.InProgress)); + Assert.DoesNotContain(payouts, data => data.State != PayoutState.InProgress); }); // settings that were added later @@ -4536,7 +4536,7 @@ namespace BTCPayServer.Tests payouts = await adminClient.GetStorePayouts(admin.StoreId); try { - Assert.Single(payouts.Where(data => data.State == PayoutState.InProgress && data.Id == payoutThatShouldBeProcessedStraightAway.Id)); + Assert.Single(payouts, data => data.State == PayoutState.InProgress && data.Id == payoutThatShouldBeProcessedStraightAway.Id); } catch (SingleException) { @@ -4580,7 +4580,7 @@ namespace BTCPayServer.Tests await afterHookTcs.Task.WaitAsync(TimeSpan.FromSeconds(5)); payouts = await adminClient.GetStorePayouts(admin.StoreId); - Assert.Single(payouts.Where(data => data.State == PayoutState.AwaitingPayment && data.Id == payoutThatShouldNotBeProcessedStraightAway.Id)); + Assert.Single(payouts, data => data.State == PayoutState.AwaitingPayment && data.Id == payoutThatShouldNotBeProcessedStraightAway.Id); beforeHookTcs = new TaskCompletionSource(); afterHookTcs = new TaskCompletionSource(); @@ -4613,7 +4613,7 @@ namespace BTCPayServer.Tests await afterHookTcs.Task.WaitAsync(TimeSpan.FromSeconds(5)); payouts = await adminClient.GetStorePayouts(admin.StoreId); - Assert.Empty(payouts.Where(data => data.State != PayoutState.InProgress)); + Assert.DoesNotContain(payouts, data => data.State != PayoutState.InProgress); } @@ -4690,11 +4690,11 @@ namespace BTCPayServer.Tests await client.AddOrUpdateOnChainWalletObject(admin.StoreId, "BTC", new AddOnChainWalletObjectRequest() { Type = "newtype", Id = test1.Id }); testObj = await client.GetOnChainWalletObject(admin.StoreId, "BTC", test); - Assert.Single(testObj.Links.Where(l => l.Id == "test1" && l.LinkData["testData"]?.Value() == "lol")); - Assert.Single(testObj.Links.Where(l => l.Id == "test1" && l.ObjectData["testData"]?.Value() == "test1")); + Assert.Single(testObj.Links, l => l.Id == "test1" && l.LinkData["testData"]?.Value() == "lol"); + Assert.Single(testObj.Links, l => l.Id == "test1" && l.ObjectData["testData"]?.Value() == "test1"); testObj = await client.GetOnChainWalletObject(admin.StoreId, "BTC", test, false); - Assert.Single(testObj.Links.Where(l => l.Id == "test1" && l.LinkData["testData"]?.Value() == "lol")); - Assert.Single(testObj.Links.Where(l => l.Id == "test1" && l.ObjectData is null)); + Assert.Single(testObj.Links, l => l.Id == "test1" && l.LinkData["testData"]?.Value() == "lol"); + Assert.Single(testObj.Links, l => l.Id == "test1" && l.ObjectData is null); async Task TestWalletRepository() { diff --git a/BTCPayServer.Tests/ThirdPartyTests.cs b/BTCPayServer.Tests/ThirdPartyTests.cs index 4c7c1881b..63f0330a3 100644 --- a/BTCPayServer.Tests/ThirdPartyTests.cs +++ b/BTCPayServer.Tests/ThirdPartyTests.cs @@ -601,7 +601,7 @@ retry: foreach (var rate in rates) { - Assert.Single(rates.Where(r => r == rate)); + Assert.Single(rates, r => r == rate); } } diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 6fbe898be..dfb3ec824 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -194,7 +194,7 @@ namespace BTCPayServer.Tests [Fact] [Trait("Integration", "Integration")] - public async void CanStoreArbitrarySettingsWithStore() + public async Task CanStoreArbitrarySettingsWithStore() { using var tester = CreateServerTester(); await tester.StartAsync(); @@ -1099,7 +1099,7 @@ namespace BTCPayServer.Tests [Fact(Timeout = LongRunningTestTimeout)] [Trait("Integration", "Integration")] - public async void CheckCORSSetOnBitpayAPI() + public async Task CheckCORSSetOnBitpayAPI() { using var tester = CreateServerTester(); await tester.StartAsync(); @@ -1539,7 +1539,7 @@ namespace BTCPayServer.Tests // We allow BTC and LN, but not BTC under 5 USD, so only LN should be in the invoice var vm = await user.GetController().CheckoutAppearance().AssertViewModelAsync(); Assert.Equal(2, vm.PaymentMethodCriteria.Count); - var criteria = Assert.Single(vm.PaymentMethodCriteria.Where(m => m.PaymentMethod == btcMethod.ToString())); + var criteria = Assert.Single(vm.PaymentMethodCriteria, m => m.PaymentMethod == btcMethod.ToString()); Assert.Equal(btcMethod.ToString(), criteria.PaymentMethod); criteria.Value = "5 USD"; criteria.Type = PaymentMethodCriteriaViewModel.CriteriaType.GreaterThan; @@ -2421,7 +2421,7 @@ namespace BTCPayServer.Tests [Fact(Timeout = LongRunningTestTimeout)] [Trait("Integration", "Integration")] - public async void CheckOnionlocationForNonOnionHtmlRequests() + public async Task CheckOnionlocationForNonOnionHtmlRequests() { using var tester = CreateServerTester(); await tester.StartAsync(); @@ -3048,7 +3048,7 @@ namespace BTCPayServer.Tests [Fact] [Trait("Integration", "Integration")] - public async void CanUseLocalProviderFiles() + public async Task CanUseLocalProviderFiles() { using var tester = CreateServerTester(); await tester.StartAsync(); @@ -3273,7 +3273,7 @@ namespace BTCPayServer.Tests var fullyPaidIndex = report.GetIndex("FullyPaid"); var completedIndex = report.GetIndex("Completed"); var limitIndex = report.GetIndex("Limit"); - var d = Assert.Single(report.Data.Where(d => d[report.GetIndex("InvoiceId")].Value() == inv.Id)); + var d = Assert.Single(report.Data, d => d[report.GetIndex("InvoiceId")].Value() == inv.Id); Assert.Equal(fullyPaid, (bool)d[fullyPaidIndex]); Assert.Equal(currency, d[currencyIndex].Value()); Assert.Equal(completed, GetAmount(completedIndex, d));