Turn off logging when exception is tested
MODIFY
WalletWasabi.Tests/CryptoTests.cs
WalletWasabi.Tests/CryptoTests.cs
@@ -45,7 +45,10 @@ namespace WalletWasabi.Tests
Assert.NotEqual(toEncrypt, encypted);
decrypted = StringCipher.Decrypt(encypted, password);
Assert.Equal(toEncrypt, decrypted);
+ var restoreLogMinLevel = Logger.MinimumLevel;
+ Logger.SetMinimumLevel(LogLevel.Critical);
Assert.Throws<CryptographicException>(() => StringCipher.Decrypt(encypted, "wrongpassword"));
+ Logger.SetMinimumLevel(restoreLogMinLevel);
}
[Fact]

MODIFY
WalletWasabi.Tests/ExternalApiTests.cs
WalletWasabi.Tests/ExternalApiTests.cs
@@ -43,7 +43,10 @@ namespace WalletWasabi.Tests
Assert.Contains("AUD", rates.Select(x => x.Code));
Assert.Contains("USD", rates.Select(x => x.Code));
+ var restoreLogMinLevel = Logger.MinimumLevel;
+ Logger.SetMinimumLevel(LogLevel.Critical);
await Assert.ThrowsAsync<HttpRequestException>(async () => await client.PushTransactionAsync(new Transaction(), CancellationToken.None));
+ Logger.SetMinimumLevel(restoreLogMinLevel);
}
}

MODIFY
WalletWasabi.Tests/KeyManagementTests.cs
WalletWasabi.Tests/KeyManagementTests.cs
@@ -6,6 +6,7 @@ using System.IO;
using System.Security;
using System.Text;
using Xunit;
+using WalletWasabi.Logging;
namespace WalletWasabi.Tests
{
@@ -44,7 +45,10 @@ namespace WalletWasabi.Tests
var sameManager = new KeyManager(manager.EncryptedSecret, manager.ChainCode, manager.ExtPubKey);
var sameManager2 = new KeyManager(manager.EncryptedSecret, manager.ChainCode, password);
+ var restoreLogMinLevel = Logger.MinimumLevel;
+ Logger.SetMinimumLevel(LogLevel.Critical);
Assert.Throws<SecurityException>(() => new KeyManager(manager.EncryptedSecret, manager.ChainCode, "differentPassword"));
+ Logger.SetMinimumLevel(restoreLogMinLevel);
Assert.Equal(manager.ChainCode, sameManager.ChainCode);
Assert.Equal(manager.EncryptedSecret, sameManager.EncryptedSecret);
@@ -92,7 +96,10 @@ namespace WalletWasabi.Tests
var filePath = Path.Combine(SharedFixture.DataDir, nameof(CanSerialize), "Wallet.json");
DeleteFileAndDirectoryIfExists(filePath);
+ var restoreLogMinLevel = Logger.MinimumLevel;
+ Logger.SetMinimumLevel(LogLevel.Critical);
Assert.Throws<FileNotFoundException>(() => KeyManager.FromFile(filePath));
+ Logger.SetMinimumLevel(restoreLogMinLevel);
manager.ToFile(filePath);

MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -1029,6 +1029,8 @@ namespace WalletWasabi.Tests
new WalletService.Operation(scp, Money.Satoshis(5), "")
};
+ var restoreLogMinLevel = Logger.MinimumLevel;
+ Logger.SetMinimumLevel(LogLevel.Critical);
// toSend cannot be null
await Assert.ThrowsAsync<ArgumentNullException>(async () => await wallet.BuildTransactionAsync(null, null, 0));
@@ -1122,6 +1124,7 @@ namespace WalletWasabi.Tests
// `Custom change` and `spend all` cannot be specified at the same time
await Assert.ThrowsAsync<ArgumentException>(async () => await wallet.BuildTransactionAsync(null, operations, 2, false, null, Script.Empty));
+ Logger.SetMinimumLevel(restoreLogMinLevel);
operations = new[] { new WalletService.Operation(scp, Money.Coins(0.5m), "") };
btx = await wallet.BuildTransactionAsync("password", operations, 2);

Turn off logging when exception is tested